Closed simb4 closed 4 years ago
next.js static method getInitialProps is consumed by HOC. I assume it erases it on some step. Not sure why.
getInitialProps
class Index extends React.Component { static async getInitialProps({ store, query }) { return { x: 5 }; } render() { console.log(this.props.x); // undefined } } export default withAlert()(Index);
I think, it is not expected behavior.
Hi @simb4. getInitialProps should not be consumed by withAlert HOC as it redirects the props to the wrapped Component Do you have a sandbox with not working example?
withAlert
next.js static method
getInitialProps
is consumed by HOC. I assume it erases it on some step. Not sure why.I think, it is not expected behavior.