36 ms·
I'm doing exactly that at work. When you write React code (whether for a single-page React application or a mostly-legacy application), there is a point where
by mercurial 11y ago
I'm doing exactly that at work.
When you write React code (whether for a single-page React application or a mostly-legacy application), there is a point where you need to tell React to start rendering a root component inside a given, existing DOM element. Your legacy application should NOT mess with anything under this DOM element, as this will be solely managed by React. However, it is entirely possible to have several of these root components on the same HTML page. It makes it possible to refactor a complex page progressively. You're still going to run into issues if you need communication between legacy and Reactified UI elements, though. You will need to setup, eg, listeners manually. In the case where you need to update parts of a form, just tell your React store to write to hidden input fields instead of doing Ajax with the server.