Is there any storage that shares data between the client and server in nuxt3?

48 Views Asked by At

I am working on a nuxt project with light and dark mode to switch. But the page would flash from light mode to dark mode if the HTML has class="dark" Since this property is been handled in client and pop-in after the SSR response. Is there any way to pass the current theme value to nitro?

nitroApp.hooks.hook('render:html', (html) => {

     if(storage.client.theme.isDark){
            html.htmlAttrs.push('class="dark"')
     }
})
0

There are 0 best solutions below