Next.js 13… this changes everything
Key Takeaways
Next.js 13 introduces a new build tool called Turbo Pack, a new routing system, and improved data fetching capabilities, making it a game-changer for web development. The new features include a directory-based routing system, server components, and caching, which provide a faster and more efficient developer experience.
Full Transcript
it is October 26 2022 and you're watching the code report just when you thought you had web development all figured out Along Comes an entirely new build tool and a complete overhaul of your favorite framework we're ready for a new paradigm not enough men's and disease of evil the reality [Music] JavaScript it's a wild ride next JS comp happened yesterday and they made an extremely ballsy move to take the world's most popular JavaScript framework and linchpin of a unicorn startup and totally change up the developer experience as you're about to see these new features are game changing and blazingly fast but they're not without their trade-offs buckle up because we've got a lot to unpack starting with a brand new build tool called turbo pack now I know you just switched over to the next gen build tool V last week but a new character is spawned versel employs Tobias coppers the creator of webpack who knows a thing or two about module bundling turbo pack was built from the ground up with rust which appeals to our novelty bias and it integrates turbo repo to Cache duplicate operations together these factors can satisfy your need for blazingly fast speed turbo pack shows updates 10 times faster than Veet and 700 times faster than webpack shots fired shots fired turbo pack sounds amazing but it's currently an alpha and I'm a bit skeptical there's a massive ecosystem of webpack plugins that will likely make migration very hard for existing apps Versa will likely need to count on community contributions with some kind of plug-in system and that might be difficult because JavaScript developers like me are too dumb and lazy to learn rust furthermore these speed gains are mostly relevant to Big Enterprise projects where teams over engineer these giant monstrosities to guarantee job security Veet with es build is already fast enough for most projects and it's got an awesome developer experience that's hard to beat you should also know that Purcell has an angle to make money on this by remotely caching builds in the cloud and parcel has been using this architecture for a long time as well what's way more exciting for me is the brand new routing system the best possible router which adds a smorgasbord of new possibilities and performance improvements to the framework these are huge changes that they worked on directly with the react core team but before you freak out everything can be incrementally adopted so it won't break your existing project next 13 adds a new app directory that also uses file system-based routing like before but now it's all directory based along with a bunch of naming conventions for different use cases to create a page you give the direct the name of the route then add a page.js file to it that exports the component you want to display there nice and simple however because it's a directory we can co-locate extra components here as well instead of needing to create a separate components directory or some other kind of convention more importantly though it opens the door to layouts and nested routing when you give a file the name of layout.js it creates a UI that can be inherited by the child routes and when you navigate to a route inside of a layout only the inner UI is rendered as opposed to the entire page this is really cool because we also have file naming conventions for loading and error that can render a different UI at the component level based on its current state for example if the component breaks it will render error.js instead of page.js while the rest of the UI stays intact and this just makes life so much easier but by far the most epic feature in this new release is data fetching next is what you would almost call the official react framework now that's our endorsement that this is the data fetching solution for react that everyone I think has been been waiting for what I I haven't told you yet is that all of these components are react server components by default server components are a low level primitive in react that enables server-side rendering but until now they've always been kind of difficult for the common developer to use it's a huge deal because now we can totally get rid of things like get static props and get server-side props instead we can just write a plain JavaScript function that uses Fetch and then await the result of that function directly in a component no need to pass props back and forth between client and server it feels totally natural like you're just using vanilla JavaScript and you don't even need to serialize data which can be a major pain Point furthermore you can take Concepts like ISR SSR and SSG and remove them from your brain the new mental model revolves entirely around caching by default all pages will be cached to provide the performance of a static site but if you want new data on every request like SSR you can add the Cache no store option to fetch or for incremental static regeneration use the next option with the number of rebalidate seconds and what's also amazing about all this is that the UI can be incrementally streamed in thanks to react suspense all you have to do is Define a loading.js file to define the UI if a component is still awaiting data it will automatically show it at the component level while rendering everything else in the application game changing but many of these features are clearly inspired by remix credit where credit is due but all is fair in love and MIT license code but one thing next is missing is a way to write data similar to remix forms which I think is a really great feature and weirdly there's no way to write API routes in the new app directory as far as I can tell and to me that just seems like a sloppy loose end as I showed data fetching looks amazing but mutations are an entirely different story in the docs it says the next team is working on a new RFC for mutating data but currently you would use a client-side component write your mutation logic then pass a callback function of refresh to update any data on that route after the mutation is complete this is kind of similar to how things work in react query but it seems like the framework could provide a more intuitive solution here overall I think next 13 looks amazing however these are major changes that basically make every next JS tutorial out there obsolete even if these changes are a step forward the reality is that people don't like change like people were riding in the streets when view 2 went to view 3 even though it too can be adopted incrementally right now everybody's super excited about these new features but if you're the guy that has to migrate all that code your initial excitement might soon turn to anger another criticism is that a Hello World app is still 90 kilobytes of JavaScript it seems like it should be able to ship zero JavaScript apps like Astro quick and so on but that doesn't appear to be the case in addition to the features I mentioned there are all kinds of small optimizations and one of them was even inspired by a video I made Edge functions can now be set to a specific region and it's great to see these big companies recognize that the shape of the planet is not an oblate sphere but rather a level plane and lastly I'm working on a longer full tutorial for next 13 which will be on my new channel Beyond fireship so make sure to subscribe over there this has been the code report thanks for watching and I will see you in the next one [Music]
Original Description
Next.js version 13 was announced yesterday and it brings huge changes to the framework. They collaborated directly with the React team to create the ultimate web framework and a new webpack replacement built with Rust... let's take a first look.
#javascript #tech #TheCodeReport
💬 Chat with Me on Discord
https://discord.gg/fireship
🔗 Resources
Next 13 Announcement https://nextjs.org/blog/next-13
Turbopack Announcement https://vercel.com/blog/turbopack
Next.js Full Course https://fireship.io/courses/react-next-firebase/
Next in 100 Seconds https://youtu.be/Sklc_fQBmcs
🔥 Get More Content - Upgrade to PRO
Upgrade at https://fireship.io/pro
Use code YT25 for 25% off PRO access
🎨 My Editor Settings
- Atom One Dark
- vscode-icons
- Fira Code Font
🔖 Topics Covered
- What changed in Next.js 13?
- Should I upgrade to Next 13?
- Next.js vs Remix
- Next.js vs Nuxt
- Vite vs Turbopack
- Replacing webpack with Turbopack
Watch on YouTube ↗
(saves to browser)
Sign in to unlock AI tutor explanation · ⚡30
Playlist
Uploads from Fireship · Fireship · 0 of 60
← Previous
Next →
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
Angular 4 Development and Production Environments with Firebase
Fireship
OAuth with Angular and Firebase Tutorial
Fireship
Anonymous Authentication with Angular and Firebase - Lazy Registration
Fireship
Angular Router Guards for Firebase Users
Fireship
Angular Firebase CRUD App with NoSQL Database Tutorial
Fireship
Upload Files from Angular to Firebase Storage
Fireship
How to Deploy an Angular App to Firebase Hosting
Fireship
Sharing Data between Components in Angular
Fireship
Loading Spinners for Asynchronous Firebase Data
Fireship
Angular 4 Transactional Email with Google Firebase Cloud Functions
Fireship
Firebase Database Rules Tutorial
Fireship
Autocomplete Search with Angular4 and Firebase
Fireship
Reddit Inspired Upvoting System with Angular and Firebase NoSQL
Fireship
Angular Drag-and-Drop File Uploads to Firebase Storage
Fireship
Text Translation with Firebase Cloud Functions onWrite and Angular 4
Fireship
Custom Usernames with Firebase Authentication
Fireship
Twitter-Inspired Follow Unfollow Feature with Firebase and Angular 4
Fireship
Simple Pagination with Firebase and Angular 4
Fireship
How to Connect Firebase Users to their Data - 3 Methods
Fireship
Add Toast Message Notifications to your Angular App
Fireship
Facebook-Inspired Reactions System with Angular and Firebase
Fireship
Learn NgModule in Angular with Examples
Fireship
Lazy Loading Components in Angular 4
Fireship
Stripe Checkout Payments with Angular and Firebase - Part 1
Fireship
Process Stripe Payments with Firebase Cloud Functions - Part 2
Fireship
Selling Digital Content in Angular with Stripe Payments - Part 3
Fireship
Angular 4 Full Text Search with Algolia - Part 1
Fireship
Algolia with Firebase Cloud Functions - Part 2
Fireship
Firebase Phone Authentication in Angular 4
Fireship
Top 7 RxJS Concepts for Angular Developers
Fireship
Learn Angular Animations with 5 Examples
Fireship
Advanced Firebase Data Filtering (Multi-Property)
Fireship
Realtime Maps with Mapbox + Firebase + Angular
Fireship
Angular Reactive Forms with Firebase Database Backend
Fireship
Send Push Notifications in Angular with Firebase Cloud Messaging
Fireship
Top 7 Ways to Debug Angular 4 Apps
Fireship
Infinite Scroll with Angular and Firebase
Fireship
Use TypeScript with Firebase Cloud Functions
Fireship
Realtime Graphs and Charts with Plotly and Firebase
Fireship
Role-Based User Permissions in Firebase
Fireship
User Presence System in Realtime - Online, Offline, Away
Fireship
Location-based Queries with GeoFire and Angular Google Maps
Fireship
Angular ngrx Redux Quick Start Tutorial
Fireship
Angular Ngrx Effects with Firebase Database
Fireship
Progressive Web Apps with Angular
Fireship
Angular Ngrx with Firebase Google OAuth User Authentication
Fireship
RxJS Quick Start with Practical Examples
Fireship
Send SMS Text Messages with Twilio and Firebase
Fireship
Firebase Database Performance Profiling
Fireship
Native Desktop Apps with Angular and Electron
Fireship
Subscription Payments with Stripe, Angular, and Firebase
Fireship
Firestore with AngularFire5 Quick Start Tutorial
Fireship
Angular HTTP Client Quick Start Tutorial
Fireship
Google Sign-In with Firestore Custom User Data
Fireship
Star Review System from Scratch with Firestore + Angular
Fireship
Angular Chatbot with Dialogflow (API.ai)
Fireship
Learn @ngrx/entity and Feature Modules
Fireship
Infinite Scroll Pagination with Firestore
Fireship
Faster Firestore via Data Aggregation
Fireship
Contentful - CMS for Angular Progressive Web Apps
Fireship
More on: JavaScript Fundamentals
View skill →Related Reads
📰
📰
📰
📰
I built a landing page with Three.js, vanilla JS, and zero frameworks — here's what I learned
Dev.to · Ayush Shekhar
Part 1: Why I Rarely Use useEffect Anymore (and what I use instead)
Dev.to · Alejandro
HTML Canvas Cheat Sheet for Pixel Art & Image Effects
Dev.to · lemon
Draw Pixel Art with Vanilla JS — A Step-by-Step Guide
Dev.to · lemon
🎓
Tutor Explanation
DeepCamp AI