How do I make an increment so every question just adds ++ How do I go from questionaire/5 into questionaire/2 using navigate?
navigate("questionare/2") - leads me into /questionaire/1/questionaire/2
You can do this using an absolute path (e.g: '/questionaire/2') or a relative path (e.g: '2'), you can either do this using a Link or programmatically using a useNavigate hook.
const navigate = useNavigate()
const handleClick = () => {
navigate('2')
//or
navigate('/questionaire/2')
}
Your current code is using a relative path plus and adding entire path, which leads to duplicated path as you mentioned.
* Be the first to Make Comment