[Vuejs]-What is the equivalent to beforeNuxtRender in Nuxt 3?

-1👍

If you want to pass data from server-side to client-side you should use useState

// plugins/foo.server.ts
export const useFoo = () => useState('foo', () => 'bar')

export default defineNuxtPlugin((nuxtApp) => {
  const foo = useFoo();
})
// useFoo composable 
const foo = useState('foo');

console.log(foo.value) // 'bar'

more in docs https://nuxt.com/docs/getting-started/state-management

👤fakie

Leave a comment