href value is missing query values to be interpolated properly

Solutions on MaxInterview for href value is missing query values to be interpolated properly by the best coders in the world

showing results for - "href value is missing query values to be interpolated properly"
Mika
27 Jan 2017
1// It is important to include ...router.query because there if where the [dynamic] current value is included, so we need to keep it.
2// Reference: https://github.com/vercel/next.js/blob/master/errors/href-interpolation-failed.md
3
4const myRedirectFunction = function () {
5
6    if (typeof window !== 'undefined') {
7        router.push({
8            pathname: router.pathname,
9            query: {...router.query, myqueryparam: 'myvalue'},
10        })
11    }
12
13}
14
15
16return (
17    <button onClick={myRedirectFunction}>Continue</button>
18)