Replies: 1 comment 6 replies
-
The meta function export from every route that needs custom meta is not a React component, in that case, React context can't be used. I assume Remix will call it from the REAL |
Beta Was this translation helpful? Give feedback.
6 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm implementing light/dark mode in my blog using Remix. The light/dark data is not persistent, so the server always renders the default light mode. when the page lands on the browser, I want to use js to progressive enhance the experience by reading the mode data from localStorage, if it isn't set yet, use the light/dark mode of the system. the reader can also toggle between light and dark, data will be persistent to localStorage.
The thing is if I only adjust the page background colour base on mode data, there will be a white area appear at the top of the browser(I'm using safari on an iPhone, but I think it applies to another browser), turn out I should also change
theme-color
in the meta, so the colour of the top area of my browser will adjust accordingly with the current light/dark mode.The light/dark is a state inside the
Root
component. As far as I am concerned, there is no way for me to pass it to theMeta
component which makes adjusting the meta dynamically possible.I really want to keep light/dark mode data as a state of my component rather than a part of the URL. This is how many blogs do nowadays.
Beta Was this translation helpful? Give feedback.
All reactions