New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
option to disable div wrapper (but keep all inside Component) #12
Comments
Or to add external wrapper only when top level inner divs more than one? (React restriction) |
any suggestions? |
You should be able to achieve this by setting the <MyMDXComponent factories={{
wrapper: (props, ...children) => children
}} /> You can see how this works by looking at the generated JS: import React, { createElement, createFactory } from 'react'
export default function({ factories={} }) {
const {
wrapper = createFactory('div'),
} = factories
return wrapper({},
createElement("footer", { className: "my-footer" })
)
} |
thanks! Want this example in documentation! And how to configure that as default behavior in webpack loader? (all our components have wrapper already) |
And React 16 allow arrays returns... |
I don't think there is currently a way to configure default factories via the webpack loader (or at all, really). This is something that has come up before. I'm going to re-open this one, but don't have time to work on it at the moment. If you have a good solution, I'd be happy to merge it. |
I was getting an error about keys so I changed this: <MyMDXComponent factories={{
wrapper: (props, ...children) => children
}} /> To this: <MyMDXComponent factories={{
wrapper: (props, ...children) => React.Children.toArray(children),
}} /> |
Closing this issue as I've deprecated mdxc in favor of https://github.com/mdx-js/mdx |
i.e. I want
<footer></footer>
, not<div><footer></footer></div>
The text was updated successfully, but these errors were encountered: