Pass promise to client component
Answered
Sun bear posted this in #help-forum
Sun bearOP
Is it currently possible to pass a promise from a server component to a client component?
The React docs for
https://react.dev/reference/react/use#streaming-data-from-server-to-client
But I'm not sure if Next supports this or not. I'm getting an error when I try to do it that the thing isn't serializable.
The React docs for
use claim that it is:https://react.dev/reference/react/use#streaming-data-from-server-to-client
But I'm not sure if Next supports this or not. I'm getting an error when I try to do it that the thing isn't serializable.
Answered by Sun bear
nevermind I think I figured it out, I was accidentally including a class instance in the resolve value of the promise
3 Replies
Sun bearOP
nevermind I think I figured it out, I was accidentally including a class instance in the resolve value of the promise
Answer
Sun bearOP
the error message made me think it was the promise itself that was the issue
@Sun bear the error message made me think it was the promise itself that was the issue
Sun bear
hi, how did u solved it? I'm also getting error and cant find a solution. I'm passing promise only