Answer the question
In order to leave comments, you need to log in
How to embed react in a separate page?
I have several web applications in which, for example, I need to implement a complex form or grid. How to connect React so that they can render the content I need, because if you write in pure js, you get porridge?
Answer the question
In order to leave comments, you need to log in
At the application entry point (app.js(x)) of your page, declare a function and pass props for initialization and call `render` from `react-dom`.
window.renderView = function (data) {
render(<App
foo={data.foo}
bar={data.bar}
/>, document.getElementById('app'));
};
<div id="app"></div>
<script>
renderView({
foo: 1,
bar: 'prop'
})
</script>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question