I have multiple pages . each stuff has a different theme or different palette. what is the best way to handle it in react with material ui
I tried with CustomTheemProvider like this tutorial:
but while loading i still see the previous theme
so Imeplemeted theme like the following: created 2 themes 1 for home page and 1 for login and each of them manage separately in the theme folder by createMuiTheme() is it a good solution and gives control of themes?
app.ts
return (
<>
{isReady === true ? (
<ConnectedRouter history={history}>{routes}</ConnectedRouter>
) : (
<Spinner />
)}
</>
);
home.ts
return (
<ThemeProvider theme={mainTheme}>
<CssBaseline />
<Header />
<main>
<Container maxWidth="xl">
.....
</Container>
</main>
</ThemeProvider>
);
Login page
<ThemeProvider theme={loginTheme}>
<CssBaseline />
login stuff
<ThemeProvider />