Modals in Next.js
Unanswered
Chinese Alligator posted this in #help-forum
Chinese AlligatorOP
Optimal way to create modals in next.js without use of any state, as it's force me use 'use client' directive,
4 Replies
@Chinese Alligator Optimal way to create modals in next.js without use of any state, as it's force me use 'use client' directive,
how do you want to store if the modal is open or not without any state? 🤔
@Chinese Alligator Optimal way to create modals in next.js without use of any state, as it's force me use 'use client' directive,
https://nextjs.org/docs/app/building-your-application/routing/intercepting-routes#modals
...but why do you want to avoid "use client"? client components are not bad and it is a bad idea to avoid them at all costs.
...but why do you want to avoid "use client"? client components are not bad and it is a bad idea to avoid them at all costs.
I'm managing all my modals using client server composition pattern, where I'm creating a Modal Context at the top level and using it throughout the website without significantly increasing client side Js Bundle.