I'm working on a CMS where users can create their website...
We are running the admin panel on ReactJS and the created website on NextJS on 2 different projects.
I want to give my users to change the theme of their website from the admin panel. and then set an environment variable on the frontend (NextJS) to apply the theme of their website
Something like:
# .env
WEBSITE_THEME = "summer"
and I will have to call the variable on my _app.tsx
function MyApp({ Component, pageProps }: AppProps) {
return(
<ThemeProvider theme={process.env.WEBSITE_THEME}>
<Component {...pageProps} />
</ThemeProvier>
)
}
I would like to know if I could change the env variable on my NextJS project when the user changes theme on the admin panel (ReactJS project)