I am developing a dynamic page, the main template is rendered on PHP, there is a root block for react in which there is a certain logic; The question is how to have two different react-applications in one file, depending on some parameter coming from the outside, for example, one page will be "brands" and for the other "reviews", you also need to give parameters from the outside, for example id
a thought comes to mind in the root file index.js and parse url and resolve this case by if-else statements. but something tells me that this is a bad programming tone
I’m doing backend, so I don’t know the right solution for the react. any ideas?
import React from "react";
import ReactDOM from "react-dom";
import Brands from "./components/Brands.js";
ReactDOM.render(<Brands />, document.getElementById("root"));