-
-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SSR Example #2
Comments
Does it helps? https://github.com/nanostores/i18n#server-side-rendering |
in this example How can i hydrate locales to store and cleanup on server? So, in Next.js i need serialised data to import { locale } from 'nanostores'
let locale, i18n
if (isServer) {
locale = atom(db.getUser(userId).locale || parseHttpLocaleHeader())
i18n = createI18n(locale, {
async get (code) {
return JSON.parse(await readFile(`public/translations/${code}.json`))
}
})
} else {
…
}
export { locale, i18n } |
You need to use your framework’s APIs for this. You can avoid using a separated file for every store and initialize all stores together in some functions like
Sorry, I do not use Next.js to suggest exact solution. If you need some specific API, ask for it. |
I am closing this issue. We have a similar “What is the best SSR integration” discussion in main Nano Stores repository. But without an API suggestions from Next.js users I can’t help. |
It would be very nice to see an example for SSR with for example nextjs
The text was updated successfully, but these errors were encountered: