Next 13 Clarification
Answered
Chinese perch posted this in #help-forum
Chinese perchOP
Hey everyone, sorry if this has already been answered/I'm doing something wrong.
I want to use NextJS 13 for my next project, but I'm struggling to wrap my head around the whole, "server components by default" thing. I want to use chakra-ui components, which can't be used with server components, so that eliminates my ability to do server-side actions. Previously when I was using next 12, you'd use a /api folder to define server functions, but that doesn't seem to work anymore. Am I doing something wrong?
I want to use NextJS 13 for my next project, but I'm struggling to wrap my head around the whole, "server components by default" thing. I want to use chakra-ui components, which can't be used with server components, so that eliminates my ability to do server-side actions. Previously when I was using next 12, you'd use a /api folder to define server functions, but that doesn't seem to work anymore. Am I doing something wrong?
Answered by linesofcode
@Chinese perch the next 13 features are entirely opt in, so you can setup your project with a pages directory just like you did in next 12, if that works for you.
4 Replies
@Chinese perch the next 13 features are entirely opt in, so you can setup your project with a pages directory just like you did in next 12, if that works for you.
Answer
Same with pages/api
It should work out of the box unless you explicitly disabled it via a config
Chinese perchOP
Thank you, I managed to get it functional, that's still good to know though, appreciate it 😃