preactjs / signals

Manage state with style in every framework
https://preactjs.com/blog/introducing-signals/
MIT License
3.63k stars 88 forks source link

Warning: Only plain objects can be passed to Client Components from Server Components. Objects with toJSON methods are not supported. Convert it manually to a simple value before passing it to props. #502

Closed guotie closed 5 months ago

guotie commented 5 months ago

Describe the bug

version:

@preact/signals-react": "^2.0.0",

pass the variable to child component, there is a warning: code:

  const result = signal(0)

<ChildComponent result={result} />
Warning: Only plain objects can be passed to Client Components from Server Components. Objects with toJSON methods are not supported. Convert it manually to a simple value before passing it to props.
  <... filters={[...]} result={</>}>
guotie commented 5 months ago

Maybe it's my problem.

I create the signal in server component, and the ChildComponent is client client component.