I am new at Next.js and I need your help. I have a route called "workPage" which has other nav links and upon being clicked, I want to show users new information along with the content on "workPage", but I don't know how that can be achieved in Next.js. In React.js, it's really easy. Can someone help me here, please? The below code should demonstrate what I want to do.
This is the workPage component
import { useRouter } from "next/router";
const WorkPage =()=> {
const {push} =useRouter()
const navigateHandler =()=> {
push(`/work/wiki`)
}
return (
<div>
<h1>This is Work Page.</h1>
<p>Content of work page.</p>
<button onClick={navigateHandler}>Go to work/wiki</button>
</div>
)
}
I have another component called WorkDetail
const WorkDetail =()=> {
return (
<div>
<h1>This is Work Detail Page.</h1>
</div>
)
}
This is it. When the button on workPage
gets clicked, the URL will be /work/wiki
and I want to show the WorkDetail
component along with the content on workPage