Next.js Explained: How cookies() uses AsyncLocalStorage

  Рет қаралды 9,913

Vercel

Vercel

Күн бұрын

Learn how the Node.js AsyncLocalStorage API plays a key part in the design of the cookies() function for the Next.js App Router.
◆ Learn Next.js: nextjs.org/learn
◆ Deploy your first project: vercel.com/templates/next.js/...
#vercel

Пікірлер: 24
@janglad9136
@janglad9136 2 ай бұрын
Would love more videos like this, explaining how Next works under the hood!
@KevinNYank
@KevinNYank 2 ай бұрын
I like the intent with this type of video, but there’s quite a bit of assumed knowledge here that makes it hard to follow - especially if you’re not already deep in the App Router/RSC world. Things that were stumbling blocks for me: What is Bun and why are you using it? We’re reading cookies on the server, not the client (I know you mentioned Node.js, but this bears saying explicitly). There’s a circular dependency between the two modules, index and user, in this example; is this just to keep the demo simple, or would you structure these modules this way in the real world? Why is rendering an async operation?
@thisweekinreact
@thisweekinreact 2 ай бұрын
Nice video AsyncLocalStorage is awesome 😃👌 Can't wait for it to be standardised in runtimes. AsyncContext is stage 2, wonder if it will move up soon.
@nicolasguillenc
@nicolasguillenc 2 ай бұрын
That's cool! I like this format, thank you for making these videos
@leerob
@leerob 2 ай бұрын
Glad you found it helpful!
@alexedev
@alexedev Ай бұрын
nice, please create more in-depth videos like this
@soulessshoe
@soulessshoe 2 ай бұрын
great series!
@fayrouzadham4808
@fayrouzadham4808 2 ай бұрын
can we apply the same idea for params and searchParams instead of sending it as props to the page component in nextjs ?
@goldydog1
@goldydog1 2 ай бұрын
Awesome, so this would theoretically work with the pages router too in a next 12 app that doesn't have access to cookies yet?
@gumisirizaemmanuel2411
@gumisirizaemmanuel2411 2 ай бұрын
How do you properly handle localstorage in a next js app
@kasper369
@kasper369 2 ай бұрын
pretty neat stuff
@hazemabdennadher5379
@hazemabdennadher5379 2 ай бұрын
what vs code theme are you using
@EricSproles-yf4pc
@EricSproles-yf4pc Ай бұрын
Can AsyncLocalStorage be used across Middleware and Server Components?
@hongz1
@hongz1 Ай бұрын
I still don’t get it the point of this clip. No idea about Bun, but I can response with cookie something like res.cookie(‘Name’, ‘John’) in express. So what’s the point of using nextjs?
@rijkvanwel
@rijkvanwel 2 ай бұрын
Can we use that API ourselves as well? To store contexty things like current language?
@user-tb4ig7qh9b
@user-tb4ig7qh9b 2 ай бұрын
Yes it is already used in react native project as a cache
@user-tb4ig7qh9b
@user-tb4ig7qh9b 2 ай бұрын
It is like built-in redis
@en_kratia
@en_kratia 22 күн бұрын
Use cookies() === bye bye SSG?
@yassinesafraoui
@yassinesafraoui 2 ай бұрын
Wouldn't that be weird if you run Nextjs on a lambda? For example if the user logged in and didn't use the app for some time and the lambda was shut down, well he simply lost his session I suppose if you used cookies to store session like this
@discoverlance
@discoverlance 2 ай бұрын
I suppose when a new request comes in, the cookie store will be recreated since it's more of sharing data during the request. And it will always get the cookies from the client or browser request header as seen in parseCookies function so during any request, it will be fresh data from the request.
@AurelioPita
@AurelioPita Ай бұрын
More under the hood videos please
@muhamedmouzoun
@muhamedmouzoun 2 ай бұрын
Let's eat that cookie 😂!
@kkh0101
@kkh0101 2 ай бұрын
please remove nextjs repo. what a terrible framework but i have to learn it to eat bread.
@twitchizle
@twitchizle 2 ай бұрын
Nextjs died with 13
10 common mistakes with the Next.js App Router
20:37
Vercel
Рет қаралды 174 М.
The Big Headless CMS Lie (James Mikrut)
18:14
Vercel
Рет қаралды 42 М.
Como ela fez isso? 😲
00:12
Los Wagners
Рет қаралды 25 МЛН
Did you find it?! 🤔✨✍️ #funnyart
00:11
Artistomg
Рет қаралды 121 МЛН
Normal vs Smokers !! 😱😱😱
00:12
Tibo InShape
Рет қаралды 117 МЛН
Next js 15 is Here… New Changes Again?!
8:13
JavaScript Mastery
Рет қаралды 84 М.
Trying to attack the Vercel Firewall
13:09
Vercel
Рет қаралды 11 М.
WTF Do These Even Mean
13:44
Web Dev Simplified
Рет қаралды 72 М.
MVVM vs. MVI - Understand the Difference Once and for All
18:40
Philipp Lackner
Рет қаралды 27 М.
Don't Make These Next.js Mistakes
13:01
Dave Gray
Рет қаралды 20 М.
The Story of Next.js
12:13
uidotdev
Рет қаралды 532 М.
Next.js Explained: Partial Prerendering (What? Why? How?)
11:03
Why I don't use React-Query and tRPC in Next.js
18:58
ByteGrad
Рет қаралды 68 М.
Build an AI app in 5 minutes!
7:46
Vercel
Рет қаралды 54 М.
Rust Demystified 🪄 Simplifying The Toughest Parts
14:05
Code to the Moon
Рет қаралды 167 М.
Индуктивность и дроссель.
1:00
Hi Dev! – Электроника
Рет қаралды 1,5 МЛН
Power up all cell phones.
0:17
JL FUNNY SHORTS
Рет қаралды 48 МЛН
🤔Почему Samsung ПОМОГАЕТ Apple?
0:48
Technodeus
Рет қаралды 451 М.
The power button can never be pressed!!
0:57
Maker Y
Рет қаралды 53 МЛН
Xiaomi Note 13 Pro по безумной цене в России
0:43
Простые Технологии
Рет қаралды 1,9 МЛН
5 НЕЛЕГАЛЬНЫХ гаджетов, за которые вас посадят
0:59
Кибер Андерсон
Рет қаралды 257 М.