Answers for "href value is missing query values to be interpolated properly"

1

href value is missing query values to be interpolated properly

// It is important to include ...router.query because there if where the [dynamic] current value is included, so we need to keep it.
// Reference: https://github.com/vercel/next.js/blob/master/errors/href-interpolation-failed.md

const myRedirectFunction = function () {

    if (typeof window !== 'undefined') {
        router.push({
            pathname: router.pathname,
            query: {...router.query, myqueryparam: 'myvalue'},
        })
    }

}


return (
    <button onClick={myRedirectFunction}>Continue</button>
)
Posted by: Guest on April-14-2021

Code answers related to "href value is missing query values to be interpolated properly"

Code answers related to "Javascript"

Browse Popular Code Answers by Language