I'm not sure I follow. So above you'll see how I demonstrate the usage of the dark class. But this hook allows you to get the exact value that the dark class will use, just in your react code as well.
You can change tailwind config to darkMode: 'class' and then you can use <body class="dark"> to set dark mode regardless of user's prefers-color-scheme value.
I'm not sure I follow. So above you'll see how I demonstrate the usage of the dark class. But this hook allows you to get the exact value that the dark class will use, just in your react code as well.
You can change tailwind config to
darkMode: 'class'
and then you can use<body class="dark">
to set dark mode regardless of user'sprefers-color-scheme
value.Here you have an example play.tailwindcss.com/nQueSOesIA
In this case your hook might report incorrect value.