Server / Client components variants
Unanswered
European anchovy posted this in #help-forum
European anchovyOP
My application powers multiple closely related brand websites, which are very similar.
In my application, each component has approximately two versions (variants). Depending on whether the THEME environment variable is set to "1" or "2", I aim to load the corresponding version. These versions can be vastly different, with similarities often confined to the data displayed.
Given this, all components default to server components, restricting me from importing them into client components. I'm considering using the publicly accessible environment variable (NEXT_PUBLIC) for the version switcher. Is this the best strategy? I'd appreciate any advice on how to implement this mechanism effectively.
In my application, each component has approximately two versions (variants). Depending on whether the THEME environment variable is set to "1" or "2", I aim to load the corresponding version. These versions can be vastly different, with similarities often confined to the data displayed.
Given this, all components default to server components, restricting me from importing them into client components. I'm considering using the publicly accessible environment variable (NEXT_PUBLIC) for the version switcher. Is this the best strategy? I'd appreciate any advice on how to implement this mechanism effectively.