Relative Content

Tag Archive for next.js

NEXT router.back() –> pass data

I have an understanding issue of how to use next/navigation router and passing data while using router.back().
I have a page where user can create a booking on route /booking/new. In that form they need to select from a list of existing customers. If intended customer is not existing yet he can create a new customer by clicking on “new” which brings him to the route /customer/new. Now after submitting the customer form I’m sending him back by router.back(), because this page might be also opened from other places.
How is it possible now to pass the created customer ID to the last page (in this case /bookings/new) to prefill the selection component with that customer?

Child component keeps refreshing on useState set

I have a parent component with an onChange setSearch useState. I then have another component with params search={search}. In the child component I have useEffect to call the server with the search query. It just keeps hammering the server with constant rapid refreshes. If I comment out the setRepairCentres line, it stops refreshing.

Using URL for state, nextJS

Hey I have a component which handles log in and sign up forms
I have steps for sign up, step 1 and step two
I want to have the state of the steps to be visible in the URL so I can use them, but not in the signup page.
so, then I can redirect to step two if needed, from sign in page