0

I have a button in a page. When I click on the button I want to redirect to another page and send some data. The page is client side component. I'm using nextjs version 13.4.9. Is that possible?

Main Page
const btnHandler = () => {
  // redirect to '/create-upcoming' with data
  }
<button onClick={btnHandler}  className='border border-[#C4C4C4] rounded-full px-6 py-2 text-[#4B4B4B]'>Add Upcoming Content</button>

Redirect page
const CreateUpcomingPage = () => {
  // const router = useRouter()
  // console.log(useRouter)
  return (
    <div id="container" className="fixed inset-0 bg-white flex justify-center items-center">

    </div>
  )
}

export default CreateUpcomingPage
Ibnul
  • 1
  • 1
  • Depends on that "data" you want to pass to the next page. if it is something simple like a key value pair you can use the query part of the url. But no, you can't send a JSON object or something like that. – Fabio Nettis Jul 19 '23 at 10:27

0 Answers0