I got a problem with my dynamic route. It look like this
[lang]/abc
I am trying to get query value from [lang] but when I using
In NextJS 9, one way to ensure route parameters are immediately available for page components is to get them from the context arg passed to getServerSideProps() and pass to the component as props.
For a page like [id].js,
export function getServerSideProps(context) {
return {
props: {params: context.params}
};
}
export default ({params}) => {
const {id} = params;
return You opened page with {id};
};