🎙️ Ep. 183 of @frontendfirstfm is live!
"The Philosophy of Next.js"
We talked about the motivations behind several of the design decisions in Next.js, including caching, why layouts don't have access to the URL, and why the router doesn't expose navigation events.
Enjoy!
(0:00) Intro
(2:58) Why don’t layouts re-render in Next.js?
(7:10) Push-based vs. pull-based rendering
(8:56) Thinking about re-renders in a pure React app
(11:07) Why Server Actions need to call the revalidate* APIs
(12:26) Why doesn’t Next.js pass the request to every page and layout?
(31:40) Immediate-mode rendering vs. “Do the least amount of work possible”
(51:54) Is opting-in to more re-renders framework fighting?
(53:44) Helping users by communicating the philosophy
(56:25) Why doesn’t Next.js expose global router events?
(1:00:17) Why it’s important to understand Next’s design decisions when choosing it for your next project
React tip: "use client" misconceptions (1/5)
🚫 You need to mark EVERY individual file with "use client" to ensure it is a Client Component.
✅ You only need to mark each client entry point ONCE. Modules imported into a "use client" file are already part of the client bundle.
(0:05) Adding "use client" to `3.js` marks the file as a client entry point, including it in the client bundle.
(0:11) Importing `d()` into `3.js` (a client entry point) also includes it in the client bundle.
(0:14) Adding "use client" to `4.js` has no additional bundling effect on `d()` because it is already part of the client bundle.
(0:23) All modules (and their dependencies) imported to `3.js` are included in the client bundle.
(0:26) Removing "use client" from `3.js` moves it and its dependencies into the server bundle.
By the end of 2024, you’ll likely never need these APIs again:
• useMemo, useCallback, memo → React Compiler
• forwardRef → ref is a prop
• React.lazy → RSC, promise-as-child
• useContext → use(Context)
• throw promise → use(promise)
• <Context.Provider> → <Context>
Introducing Visual Open Authoring! ✏���
Edit your live site, in real-time. Anyone can contribute. Backed by Git.
Read more on our new approach to crowdsourcing content. Better yet, try editing https://t.co/SrIJoYD72p directly 🤯 https://t.co/6xcASnoHOZ #tinacms #Nextjs
@delba_oliveira I think the next video can be about On-demand and Time-based Revalidation. What do you think? actually, I would like to know how caching mechanisms work in nextjs.