Actually I would put all the "state" in a single place.
<script>// Jinja needs to give me a JSON object for this to work.conststate={{all_the_state_i_need_from_the_server}}ReactDOM.render(React.createElement(App,state),document.getElementById('root'));</script>
Is more like JSX and javascript are not compatible.
Even if you do manage to send this to the browser:
Is not valid javascript. The browser will not understand that.
You can still use both React and Jinja2, but no JSX.
What I would do is pass the state to the component in a script tag. Like this.
Actually I would put all the "state" in a single place.
Ah, that is really smart. Thanks!
That snippet is valid, provided the parentheses are changed to a React fragment (<> </>):
Even with that, it still isn't valid javascript.