c8r / x0

Document & develop React components without breaking a sweat
https://compositor.io/x0/
MIT License
1.71k stars 65 forks source link

LiveEditor with Custom Component/ScopeProvider example? #113

Closed huy-qn closed 5 years ago

huy-qn commented 5 years ago

I am trying to use the LiveEditor from mdx with x0 but I'm having a hard time trying to make it work with my custom components. The document isn't clear about how to include it into the props scope.

Until now, I created a scope.js file like this

`import { Box } from 'rebass'

const scope = { Box }

export default scope`

then use it in the _app.js file like this <ScopeProvider scope={scope}> </ScopeProvider> But the LiveEditor is still not able to get that Box component. Am I missing something? Thank you!