Closed KosukeYoshimura closed 1 year ago
i think you have return from getinitialprops static async getInitialProps(props) { console.log(props.query) return {name: props.query.name}
}
do u mean I did not return name params?
i meant you have to return something from getInitialProps(0 method. https://github.com/zeit/next.js#fetching-data-and-component-lifecycle
You can try at least:
static async getInitialProps ({ query }) {
return await query
}
I'm facing the same problem. I return a pathname from getinitialProps() functions but It showed undefined in render() function. Any one have answer for this issue?
static async getInitialProps ({ query }) { return await query }
I tried but still show undefined
static async getInitialProps ({ query }) { return await query }
I tried but still show undefined
Which Next.js version are you using?
I think you need to return an object. It can be an object of any kind, you just need to return an object for getInitialProps to work.
Hello !
I try to get params by getInitialProps().
However, when I try to get that like this,
/pages/books/show.js
it turned error like this.
routes.js↓
Can anyone give me advice?