randomCow
TTCTheo's Typesafe Cult
•Created by randomCow on 1/28/2024 in #questions
Using Next.js for CSR only
I remember Theo once saying that he would recommend using Next.js even if you plan on doing CSR only. I am not sure how would I do that, if I am using the folder based routing I guess I always end up hitting the server for the server to decide what to return to me, even if I wrap my whole app to return null if running on the server, still some .js needs to be run on every request, which for my purposes wastes server resources for no obvious reason.
What I would like to achieve is to have a regular static html file returned with the root element and then the react just doing its thing when it gets loaded, while still having my codebase using file based routing and having the ability to make a couple of pages static or ssr when needed or easily handle securing data over a custom proxy api endpoint or something like that.
10 replies