Next.js Discord

Discord Forum

Which approach to use for keeping track of page state

Black carpenter ant posted this in #help-forum
Open in Discord
Black carpenter antOP
Hi! I'm new to Next.js 13 and I'm trying to build a simple stepped accordion (basically a checkout flow). Normally, I would just use a good old query parameter to keep track of the active step, and then update the URL accordingly as the user progresses through the flow.

But I'm struggling with converting this approach to the new app router and server-first approach. I've set it up with parallel routes, server actions on form submissions, and redirect call to navigate to the next step. It works, sort of, but I'm running into various issues and I'm wondering if I should just embrace a wrapping client component handling the step logic, and then passing in the steps as server components? What are my options?

Any inputs are much appreciated. Thanks!

0 Replies