ManuelDeLeon / viewmodel-react

Create your React components with view models.
MIT License
24 stars 3 forks source link

Docs: Mention no default export #36

Open avalanche1 opened 6 years ago

avalanche1 commented 6 years ago

It took me some time to figure out that VM's DSL doesnt export react components as default. And thus you have to use curly braces when importing your components. It would be nice to have a mention in https://viewmodel.org/#BasicsComponents

antoninadert commented 6 years ago

Well this is a bit under-the-hood. The examples you link show how to import a component. They don't tell you why you have to import like that though. Maybe it is not the same way to import components in a pure React component.

What I would recommend instead is to provide an example with a mix of pure React and VM React component in a sample starter app (showing 2 similar components) as to show the difference and how to mix them in the VM app.

Maybe this can get referenced in the doc somehow after ?

(I basically took a long time to understand how to mix them, because of the import madness)