Open talarari opened 8 years ago
It can be difficult to maintain compatibility between multiple versions of React. because React updates its version very often. so I suppose this can be difficult to make it.
Maybe have react as a peer dependency for plugins, that way plugins will use whatever version hain uses.
React api is also pretty stable by now. If you provide a renderComponent function that will take a react component and will just use react's renderDOM to render it to the preview container, it could open up the possibility to easily implement really cool previews (like interactive ones).
Which compatibility issues are you worried about?
On the other hand i see plugins are already rendered in an ifame , so maybe performance will be the same if i load react on my own, ill give it a try and see. For most previews probably html will suffice.
I almost agree with your opinion.
For now, hain-package-manager
doesn't support peer dependency installing.
so all plugin dependencies are being installed and node-modules are not shared between hain and plugins.
In this situation, I believe we couldn't follow React updates for the perfect, and I dont wanna make a additional dependency.
I noticed hain is written in react, i want ro return a preview with react, i can render an iframe i guess an bundle my own version of react , but that seems a little wasteful, and will probably load really slow. Would be cool if preview function would have a renderJSX function we can call instead of the normal render .