Reputation: 557
I am working on project, that I started with Python and Flask, as at the begginning it was quite small - the jinja templates commonly used by Flask was sufficient, but as I wanted more and more - I decided to give a try to ReactJS.
It works great for variety of things, and there is bigger control of whole frontend, and generally I like it, but Let's assume that I want to use react for X component, and in the same X component i'd like to use jinja templates - to populate it with data from Flask backend. This is the first question - 1) How should be this achieved? React is preparing javascript file, so the tempalte can't be rendered. Should I create some endpoint, and GET data needed to populate with jquery request?
The second question is - the routing. I define some endpoints in flask - but in react components I need to 'hardcode' it. Is there some solution to not have it hardcoded in 2 places?
The third question is - how do you work with that? Maybe good point is to combine React for some components, and use tempaltes for other things?
Summarizing question:
I am very interested in your opinions about this two frameworks working together :)
Upvotes: 1
Views: 1512
Reputation: 143
Upvotes: 4