You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I tried looking through the source trying to understand how Next.js works, but quite honestly it's kind of overwhelming so I'd really appreciate if someone could clarify that for me. I do understand that it does ship with a lot of extra features such as fast refresh, routing, code splitting, etc. which have led me to take an interest in the framework and figure out what it's all about.
However, like I said, I'm trying to figure out HOW it actually works. In theory, you could simply build a React CRA project and serve the index.html from the build from an express route and you've got server side rendering. In fact, I used to do that all the time with Django either rendering a Jinja template with a JQuery script tag or serving a built React app directly at / while maintaining my API at /api/*.
Now I don't see express anywhere in the source. I'm guessing they're using the low level Node.js API but I'm not sure why they'd bother to rewrite things like the body parser or sessions, etc. I understand what Next.js achieves. Obviously that express/Django stuff I was talking about wouldn't support code splitting or any other feature aside from basic SSR. I'm just looking to get behind the layer of abstraction and understand how it comes together.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
I tried looking through the source trying to understand how Next.js works, but quite honestly it's kind of overwhelming so I'd really appreciate if someone could clarify that for me. I do understand that it does ship with a lot of extra features such as fast refresh, routing, code splitting, etc. which have led me to take an interest in the framework and figure out what it's all about.
However, like I said, I'm trying to figure out HOW it actually works. In theory, you could simply build a React CRA project and serve the index.html from the build from an express route and you've got server side rendering. In fact, I used to do that all the time with Django either rendering a Jinja template with a JQuery script tag or serving a built React app directly at / while maintaining my API at /api/*.
Now I don't see express anywhere in the source. I'm guessing they're using the low level Node.js API but I'm not sure why they'd bother to rewrite things like the body parser or sessions, etc. I understand what Next.js achieves. Obviously that express/Django stuff I was talking about wouldn't support code splitting or any other feature aside from basic SSR. I'm just looking to get behind the layer of abstraction and understand how it comes together.
Beta Was this translation helpful? Give feedback.
All reactions