I have a tailor-made server-side application I’d like to be able to integrate with React
.
This application currently outputs html
pages with dynamically-generated url
‘s on them, that are used for navigation and that are needed on a per-request basis to control current state, user and session.
My original idea was to use React
to generate these pages (statically, and independently of each other, such that there was no relationship or connection between these), then upload the resulting js
and css
chunks to the server, and to let this custom application output the resulting html
‘s for each, such that once received by the client, the browser would pull js
and css
chunks from the server as normal.
So I made a React
app comprising of an AppBar
with a menu and three items, just to see if I could find my way around it. But when I build it for production, these links fall into some random js
chunk file it wouldn’t be feasible working with or patching, and I have also tried using routes with the same outcome.
Have thought on adding a <script>
element with a custom id
to the html page, where I could place these url
‘s for that specific request as js
object I could access to from React
, but I don’t really like that idea for many reasons.
Have also thought on if it would be possible to have the routes separate from the interface itself in a way I could fetch
these after page load, and hence, benefiting from what routes have to provide. That idea I like it more, but if there was a solution where I wouldn’t need to fetch
after page load on a request basis it would be even better.
So my question is, are there any facilities React
could provide that would allow me sending a html
page for which every link from within it could be specified in a dynamic fashion? I’m otherwise open to doing it server-side the React
way if no other option is available, and even though I’d need to implement it by myself, and to any related comments about this.
Who knows, maybe there are other solutions I haven’t thought of, or maybe I should be better of using some other framework, or doing things somewhat different, etc.
Thanks,