React useCookie Hook: Cookies as Reactive State (2026) A theme toggle stores the user's choice in a cookie so the server can render the right theme on the next request — no flash of the wrong mode. The component writes document. cookie = 'theme=dark' , and then… nothing re-renders.
Source: [Dev.to](https://dev.to/childrentime/react-usecookie-hook-cookies-as-reactive-state-2026-1369)