Description
Nuxt-ssr allows you to fetch data and render it on the server-side directly from a child component by using a build-in nuxt asyncData method.
Install
npm i nuxt-ssr --save
OR
yarn add nuxt-ssr
Setup
-
Include module in store as ssr namespace
const store = {returnmodules:ssr: StoreModule}; -
Link the RootMixin with components from the pages folder
;mixins: RootMixincomponents: ChildComponent -
Link the ChildMixin with components from the components folder which you want to be loaded on the server side.
mixins: ChildMixin{returnpost: {}}async {let post = await ;return post ;}You can still use context in the asyncData function. (https://nuxtjs.org/api/context/) The "created" hook would replace the data on the client side.