-
First, I'd like to express my gratitude for the development of this fantastic library. This library supports SSR through the Problems1. Need for proper Provider setup in Next.js
|
Beta Was this translation helpful? Give feedback.
Replies: 6 comments 19 replies
-
Thanks for opening up a discussion.
So, it's a new problem. You don't have such issues with Pages Router, right?
Interesting. I wasn't aware such a behavior. That sounds tricky.
I'm not sure if I follow every details, but it seems like a good step.
As I said, we don't consider this as the Jotai core feature. It's an integrations like other integrations. |
Beta Was this translation helpful? Give feedback.
-
New Please give us a feedback! |
Beta Was this translation helpful? Give feedback.
-
I realized that when using 'use client'
import { atom } from 'jotai';
export const someAtom = atom(0); This requirement exists because when
Jotai atoms include functions. To paraphrase the above quote, functions or atoms that are exported from client-marked modules can be passed from a React Server Component to a React Client Component. Therefore, adding the At least this approach works in Next.js App Router. However, I'm not sure if adding the |
Beta Was this translation helpful? Give feedback.
-
I had a misunderstanding about why However, even with the correct understanding, this library, including MisunderstandingMy incorrect understanding was as follows:
In reality, since navigation using the The mismatch between HTML and hydration was a known issue:
This issue can also be resolved by using New ProblemWith client-side navigation using the The following is an issue when trying to share Jotai's Store at the A Next.js project reproducing these issues can be found here: Problem with
|
Beta Was this translation helpful? Give feedback.
-
I think I understand at least one miscommunication. Here's the modified example: https://stackblitz.com/edit/github-dfyxta?file=src%2Fcomponents%2FRootLayoutWrapper.tsx,src%2Fpages%2F_layout.tsx,src%2Fcomponents%2Fuse-hydrate-atom.tsx |
Beta Was this translation helpful? Give feedback.
-
That sounds like a bug. I wonder if we can create a minimal reproduction. |
Beta Was this translation helpful? Give feedback.
New
jotai-ssr
lib was released!https://www.npmjs.com/package/jotai-ssr
Please give us a feedback!