Skip to content
Discussion options

You must be logged in to vote

This is expected per the docs. Next triggers an update to the router after hydration.

You must account for this in your code using something like:

const router = useRouter()
const slug = router.query.slug || [];
const target = slug[0];
const [tab, setTab] = useState(target);

useEffect(() => {
  if (target) {
     setTab(target)  
  }
}, [target])

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Axiol
Comment options

Answer selected by jamesmosier
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants