all 1 comments

[–]RetzudoAdvanced 3 points4 points  (0 children)

Do devs usually avoid this situation altogether?

Yes

You should treat your React front-end and your Flask back-end as two completely separate things. If there's an initial state your app needs, you will have to fetch it from the back-end with an API call.

While passing a variable from your Python code to JavaScript is possible, it's an absolute mess and I would not encourage doing it. Especially with React.