ShakaCode | ShakaCode Blog | Rails On Maui Blog | Rails | ReactJs | JavaScript | Webpack | Productivity |

Multiple layouts with React Router v4


Hello I am new in reactjs and I want to implement a layout for public pages, another one for login and another for the dashboard, I have managed to do it only that I can not specify the css for each one in specific, that is, I do not want the layout of the login load me the css of the public layout.

Please someone help me or give me some idea?


Why do you have this goal? What is the problem you are trying to solve?

Have you considered CSS-in-JS?

Are you using react-router?


yes I am using react-router-sun v4 and so far I have implemented it well, but I manage to do what I want. my idea that a css that even have global styles is only used for the frontend equally another for the login and another for the dashboard, so that I need 3 different layouts completely, but what I have done I join the styles and not it’s what I want