Allow configurability of React/ReactDOM instance per component #595
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi there,
This isn't a complete working/tested implementation. I'm just testing the waters to see if you guys would be amenable to a PR looking something like this.
An example problem
Imagine I've got 2 different widgets libraries being managed by 2 different teams.
widgets-coreis managed by 1 team, and is full of tried and true widgets built with React.widgets-experimentalis full of the latest widgets being developed by a different team, also with React. Both teams deliver a .js file globally exposing their widgets and are separate from the Rails team.I'm on the Rails team and everything is going great in my Rails app using
react-railsuntil I start to use widgets form bothwidgets-coreandwidgets-experimentalon the same page. They use different versions of React. The components are already unhappy with being rendered by a different version of React than they were defined with, but to make it worse,widgets-coreis still pre-0.14 andwidgets-experimentalis using React 15.x, meaning that these versions of React have different rendering interfaces! I'm stuck!Hopefully that example wasn't too contrived. It's very similar to a problem that I'm experiencing. This PR represents a potential way to solve the problem. Imagine a Rails partial that looks like this
This allows us our React components to be developed independently from the Rails app and to package up the React versions they need in order to render correctly.
Thoughts?
Totally open to suggestions and, of course, to renaming / shifting code around / whatever to conform to codebase style guides.