I'm still a learner and currently tweaking around with reactDom.render
I have two html files both linked to one .js file and I use getElementById to render react
Anyway my problem is that in my live server, the reactDom renders the divs in my index.html file, but ignores the other html file
I've used script linking to the .js file in both html files correctly
I cant imagine to try anything else, like it should work fine? Update - It is working when I use two seperate .js files one for each .html, but I want to manage both html files from one .js file
CodePudding user response:
So when working with react, react sees each HTML file as an app and not just as a file so this is the reason why the functionality of one app cannot be used for another. I suggest you just use two separate .js files for your app-building.