Hello to the netlify team !
I am trying to get the parameter ‘token’ from the dynamic route on my website made with nextjs : https://lokimo.ai/account/activate/[:token]
The published code is working locally on my machine but I can’t make it work on netlify. I have written in my netlify.toml the following redirect rule (as mentioned in this github issue https://github.com/zeit/next.js/discussions/11178#discussioncomment-4802) :
[[redirects]]
from = “/account/activate/*”
to = “/account/activate/[token].html”
status = 200
force = true
The code corresponding to /pages/account/activate/[token].js is the following :
import React, { useEffect, useState } from 'react'
function CreateInteraction ({ input }) {
const [isComponentMounted, setIsComponentMounted] = useState(false)
useEffect(() => setIsComponentMounted(true), [])
if(!isComponentMounted) {
return <h1>Not Mounted</h1>
}
else {
const router = useRouter()
return <h1>{router.query.token}</h1>
}
}
export default CreateInteraction
The page always displays “Not Mounted” and I can’t get router.query.token for a reason that I am not understanding.
Thank you very much in advance !