import { withRouter } from 'next/router' const Page = ({ router: { query } }) => ( <>

{query.id}

Go to ?id=1 Go to ?id=2 ) Page.getInitialProps = () => ({}) export default withRouter(Page)