Coder Social home page Coder Social logo

Comments (3)

dsvgl avatar dsvgl commented on June 1, 2024

This already exists: https://nuxt.com/docs/guide/directory-structure/components#server-components

from nuxt.

septatrix avatar septatrix commented on June 1, 2024

This already exists: https://nuxt.com/docs/guide/directory-structure/components#server-components

Using server components would mean that for every slightly different footer I would need a new component. The beauty of the <ClientOnly> component is that it simply accepts markup in its slot instead of requiring a new component for every area where it is used.

from nuxt.

dsvgl avatar dsvgl commented on June 1, 2024

Ah, I see. We use https://github.com/freddy38510/vue3-lazy-hydration for such things. So you can wrap your time output in template with:

<template>
  <LazyHydrationWrapper>
    {{ new Date() }}
  </LazyHydrationWrapper>
</template>

Having no lazy-hydration specific prop on < LazyHydrationWrapper> means it will never hydrate on client side.

There is also really nice nuxt-module to wrap vue3-lazy-hydration: https://github.com/Baroshem/nuxt-lazy-hydrate.
With this, you'd use <NuxtLazyHydrate> instead of <LazyHydrationWrapper>.

There is an open issue to bake this into nuxt. Hopefully it will land some day: #24242

from nuxt.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.