Help with mixing client and server
Unanswered
Blue Picardy Spaniel posted this in #help-forum
Blue Picardy SpanielOP
I have a server component. In this component I want to be able to click a button, make an API call then show a toast notification.
- Click: Server component (due to using
- API call: Server component (needs to share the result with the toast notification)
- Toast notification: Client component (due to
How would I go about this?
- Click: Server component (due to using
<form> and action)- API call: Server component (needs to share the result with the toast notification)
- Toast notification: Client component (due to
useToaster using useState)How would I go about this?
11 Replies
Chinese Egret
separate the components, that's all
@Chinese Egret separate the components, that's all
Blue Picardy SpanielOP
i got told i cant mix them tho
Chinese Egret
If you want, send me the code or an image
@Chinese Egret If you want, send me the code or an image
Blue Picardy SpanielOP
Chinese Egret
thats other problem
Blue Picardy SpanielOP
this only happens when i import my client component into my server component
Chinese Egret
That's why I tell you that you should see how you separate the use of the client from the server.
Blue Picardy SpanielOP
i separated them
and now im importing them to use them
Chinese Egret
make sure to have (process.env.NODE_ENV === 'production') in your db or auth method
Blue Picardy SpanielOP
.......?