useSearchParams() in a Server Action
Answered
David L. Bowman posted this in #help-forum
Original message was deleted.
Answered by Norwegian Forest Cat
Hey, you cannot use a server function on client side. The solution would be to create a "createTelegraOrder" on client side OR create an API endpoint (at least something on server side) OR use server actions (see https://nextjs.org/docs/app/building-your-application/data-fetching/server-actions-and-mutations). I recommand you the last option which is probably the easiest for you => you can use it in a useEffect.
1 Reply
Norwegian Forest Cat
Hey, you cannot use a server function on client side. The solution would be to create a "createTelegraOrder" on client side OR create an API endpoint (at least something on server side) OR use server actions (see https://nextjs.org/docs/app/building-your-application/data-fetching/server-actions-and-mutations). I recommand you the last option which is probably the easiest for you => you can use it in a useEffect.
Answer