Тёмный

NextJS + State Management = Good Idea??? 

Jack Herrington
Подписаться 186 тыс.
Просмотров 101 тыс.
50% 1

Опубликовано:

 

3 окт 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 227   
@demiann4160
@demiann4160 2 года назад
A 10/10 for the quality and creativity in making something unique and so valuable for all of us
@tuRistst
@tuRistst 2 года назад
Thx for videos. Don't lost a motivation to create content. We love your lessons and respect your work! Ps: special thanks for the work with nextjs
@garrettdarnell7048
@garrettdarnell7048 2 года назад
I'm finally getting into React after being an Angular dev for years, this was really helpful. Loved seeing the RxJS content in there, it helps me connect my old mental model of reactivity with the new.
@thegrumpydeveloper
@thegrumpydeveloper 2 года назад
React hook form is my go to state management no joke. Form fields are the most complex state and have so many hidden states like validity, submitting,submitted etc. It’s important to choose a form library if you’re taking any user input beyond button clicks.
@nuitech2190
@nuitech2190 2 года назад
Great, I will check that out. I have a massive form (5 - 7 tab pages) using Formik + Yup. It get really slow when I typing in input box. The whole pages get rerender every keystrokes. I hope React hook form will help.
@kadirit
@kadirit Год назад
@@nuitech2190 it will because rhf uses refs for form state out of the box, causing no re-renders
@ashish_prajapati_tr
@ashish_prajapati_tr Год назад
your solutions are so bullet proof. i was struggling for how to setup redux in server with data fetching in nexjs ssr. i found it so much helpful. Thanks a lot.
@silenux7419
@silenux7419 2 года назад
Hello Jack. Loving the typescript implementation in your videos. I think that should be the standard for all JS videos. The type safety and security of what you are doing that TS brings is great for learning.
@nishadvadgama
@nishadvadgama 2 месяца назад
Thanks a ton. I wanted to use zustand store in RSC to basically feed in state in SSR and then hydrate it in CSR to manipulate that store, after watching your video I can now.
@mooshy5944
@mooshy5944 2 года назад
Was hoping you would go into a flow such as “action” => “state update” => “getServerSideProps” => “Client Hydration & render”. I think what makes nextjs more convoluted when it comes to state management is that you can also treat query parameters as state, which in return continues the SSR even when a person for example goes to “/pokemon?page=2”
@mattl7599
@mattl7599 Год назад
Would like to see this also!
@jimjoseph554
@jimjoseph554 2 месяца назад
This is good, thanks for this video. Was really helpful.
@kodoku2377
@kodoku2377 2 года назад
I've always liked this state library called "easy-peasy" which is a very simplified version of redux and uses it under the hood, so you can use most redux features with it. Even redux devtools and it's compatible with React Native
@krisnarusdiono1304
@krisnarusdiono1304 2 года назад
sir you are my mentor now, thank you for your videos!
@ThEldeRS
@ThEldeRS 2 года назад
I would've watched this video even if it was hours long, it was so instructive and well made! Thank you for your hard work producing these wonderful videos, Jack!
@yuriiholskyi9009
@yuriiholskyi9009 2 месяца назад
Amazing video, thank you so much.
@البراءبنمالك-ر1م
Your recommendation at the very end is great. Made my realize so much. Thank you for the thorough video.
@ryanle4059
@ryanle4059 2 года назад
Thank to you, I know about Zustand. Such an amazing library. Now state management is very simple and I can even access the store outside a component. SO COOL.
@affas_r
@affas_r Год назад
Exactly what I was looking for. Great video. Thanks a lot.
@tuananhdo1870
@tuananhdo1870 2 года назад
[Copy] Thank to you, I know about Zustand. Such an amazing library. Now state management is very simple and I can even access the store outside a component. SO COOL.
@trenthm
@trenthm 2 года назад
Fantastic. We don’t deserve videos this comprehensive and well done! Learned a ton
@shahrzadgheidi6229
@shahrzadgheidi6229 2 года назад
Perfect.. Thank you so much. this was such an amazing wrap up.
@fernandobaroni1497
@fernandobaroni1497 2 года назад
Great content! TIL about Jotai, I'm loving it!! Also I'm really liking this 'Operator Mono' font!
@alfawal
@alfawal 2 года назад
Tbh, I would like to thank you a lot, your content always amazes me, knowing what each exactly does and how to use it solves my decision issues. Never subscribed or commented on any channel but you deserve support.
@markilabot14
@markilabot14 2 года назад
Jack has a high level understanding of his stack and technologies, which leads to a high quality and greatness of his video. Thanks a lot.
@leumasrodama2010
@leumasrodama2010 Год назад
It takes a lot of work to have a tuts like this., Keep up the good work. Just subscribed., :)
@jasonma1904
@jasonma1904 2 года назад
This video explained so well. Nice work and efforts! love it.
@gugunm
@gugunm Год назад
really love the way you explain, Jack
@alexsuarez667
@alexsuarez667 2 года назад
As usual Jack! Excellent video! Keep rocking
@badasspresso
@badasspresso 2 года назад
God bless people like you! So much effort, so many examples, so accurate… Thank you!!!
@shift-happens
@shift-happens 2 года назад
very nice video, thanks a lot for this overview! With NextJS, I exclusively use useState and useContext to deal with state and I was always wondering why state management libraries seem to be so important to many others.
@matkomilic8382
@matkomilic8382 2 года назад
Beautiful. Creating something that will live on. These videos are special and Im happy for younger upcoming generations for having such videos ready for them. Very enjoyable videos.
@matkomilic8382
@matkomilic8382 2 года назад
And I love how at the end "My Recommendations" is added, thats also super important.
@dyunior
@dyunior 2 года назад
Dang!! just watch few minutes, but this one is saved and bookmarked for later's playlist.
@hugodsa89
@hugodsa89 2 года назад
Jack, just thank you 🙏🏻 really great video. This is just splendid.
@JasonChannelOne
@JasonChannelOne 2 года назад
Such a helpful video! Thank you 🙏 Do you have any thoughts on ORMs and databases? A video like this for both would be great!
@robertweeden9156
@robertweeden9156 2 года назад
Jack your videos are truly too tier content. Not many content creators actually deserve a like + subscribe but your teaching style and explanations are well worth it! Keep making great stuff!
@sergioccarneiro
@sergioccarneiro 2 года назад
Very helpful comparisons, thank you! 🙏 More can be researched though, and I look forward to see your follow-up on this. Would suggest handling 1000 Pokemon next to add infinite scrolling and pagination 👌
@gemanepa5455
@gemanepa5455 Год назад
You're doing god's work here man. Thanks
@llvae
@llvae 11 месяцев назад
This was really helpful, thank you.
@ThomasBurleson
@ThomasBurleson 2 года назад
I am very impressed with the bandwidth of solutions that you have presented. Extremely useful to think about server-side renderings + data fetch along with client-side state management. Excellent video. Make a donation page and I will donate to say thank you!
@ddomingo
@ddomingo 2 года назад
This video is gold! Thank you sir.
@ProgrammingOnly
@ProgrammingOnly 8 месяцев назад
tysm sir, really appreciate it!
@byc090020
@byc090020 2 года назад
Thanks for all your work to educate us!
@milozommer1557
@milozommer1557 2 года назад
I love your videos man. Haven't watched this one yet but I'm sure it's gonna be an awesome video. I wanted to ask you if you have/could make a video talking about React query and state management, when is it necessary to add a state manager using RQ, different use cases, etc
@heguer87
@heguer87 2 года назад
you are always so great, thank you so much for explaining this. Seems simple but when we don't know we just don't know lol.
@davidentzat5671
@davidentzat5671 2 года назад
Excellent video as always!!! If you are not tired of this subject I would love to see a (perhaps simplified) version for the Remix framwork! 🙂 Thanks in any case 🙇‍♂️
@jacobphillips9235
@jacobphillips9235 6 месяцев назад
Thanks!
@bartgrundeken1428
@bartgrundeken1428 2 года назад
Great video. I like your style, very enthusiastic, balanced view, great! I use Zustand in a CRA project right now, works great. Btw...looking forward to more Remix stuff, if you have it in the pipeline ;)
@tomino133
@tomino133 2 года назад
Another great video. Huge thumbs up!
@joshuastories
@joshuastories 2 года назад
Free content. Free like. Thank you for invaluable content. (Within scope of content) thank you for promoting internet health and developer prosperity. That’s priceless in my opinion.
@AtizaJuanita
@AtizaJuanita 2 года назад
Love this video! One tiny recommendation though, I'd write lists of things in plural. In this video pokemon array should be named pokemons
@chizidotdev
@chizidotdev Год назад
This has got to be my most rewatched RU-vid video of 2022…
@syedhaider0916
@syedhaider0916 Год назад
Thank you so much for such quality content. No wonder why this channel is exploding.
@saramshshrestha7641
@saramshshrestha7641 2 года назад
Love your videos. Next time i will definitely try jotai or zustard.
@rajikkali2381
@rajikkali2381 Год назад
You deserve WAY more subscribers
@george_bullock
@george_bullock 2 года назад
Jack, this video was great. I love your content. You're the "senior" dev / mentor I wish I had at work 😄. Please keep up the good work. And thank you! 🙏🏾. Let me know if there are other ways to support you besides liking and subscribing; I'm open to that.
@johnyg8806
@johnyg8806 Год назад
This is pure gold
@jose6183
@jose6183 2 года назад
Incredible timing!
@dgcp354
@dgcp354 2 года назад
After I saw your vid on state management I started using zustand with react query and never looked back. bus never used next yet.
@jherr
@jherr 2 года назад
FWIW, I'm using Zustand in my current project and I'm lovin' it. So easy and reliable.
@hugodsa89
@hugodsa89 2 года назад
@@jherr I personally fell in love with Jotai in this video composing/piping state that is reactive but also you get to reuse the filter functions and so is actually mind blowing.
@kumailn7662
@kumailn7662 5 месяцев назад
great ... you always great
@thorjuberaalbo
@thorjuberaalbo 2 года назад
Amazing your videos and explanations, I learned so much with this one and the one of 20 state manager. In that one you say externalize the business logic can you make a video explaining that concept? Thank you so much
@maksym7279
@maksym7279 2 года назад
Great! Thanks!
@MrKeepItTrill
@MrKeepItTrill 2 года назад
The Zustand pronounciation is getting better with every video :)
@jherr
@jherr 2 года назад
Hahahaha. Thanks.
@abdallahmah1867
@abdallahmah1867 2 года назад
very much your efforts to help us noobs out.
@suryapratap3622
@suryapratap3622 2 месяца назад
great content.
@malikmusa203
@malikmusa203 2 года назад
I'm a big fan of you, Because of security reasons for JWT Token please make a video on the refresh token in NextJs. I'll thankful to you
@codernerd7076
@codernerd7076 2 года назад
Love the video editing and the topic!
@alexchud
@alexchud 2 года назад
All of your videos are great and are appreciated, just a point though the zustand example would introduce cross-request state pollution… as you are not creating a new instance of the store for every SSR request.. as a result the store is shared for all requests coming in via SSR
@jherr
@jherr 2 года назад
Yes, that is a possibility. But isn't that the case with any singleton store?
@alexchud
@alexchud 2 года назад
@@jherr yes that’s true :-), the trick is to check if it’s ssr then you would create a new instance of the store every time and if it’s hydrated on the client you would just return the singleton 😅
@jherr
@jherr 2 года назад
@@alexchud You can clean the state pretty easily by doing `useStore.set(initialState);`, and you could to that in the middleware to make sure you catch everywhere
@alexchud
@alexchud 2 года назад
@@jherr would that clear the state quick enough if you would have 100 requests coming in at the same time.. I am not sure 🤔🤷‍♀️
@jherr
@jherr 2 года назад
@@alexchud Node is single-threaded.
@adimaralimuddin96
@adimaralimuddin96 2 года назад
just look at that zustand! i really loved it. i actually replaced redux and context eversince zustand came.
@xtinctspecies
@xtinctspecies 2 года назад
Hi Jack! This was a great video. I have had the hardest time wrapping my head around making a gql api work with nextjs. Hydrating / rehydrating Apollo cache has been a difficult thing to master
@jherr
@jherr 2 года назад
I may take a look at that.
@geraldogonzalez5458
@geraldogonzalez5458 2 года назад
Subscribed, like and share. I love you.♥
@jherr
@jherr 2 года назад
Love you too! Thanks for the subscribe!
@spongebob93lover
@spongebob93lover Год назад
would love to see a SWR example too
@aminedaimallah310
@aminedaimallah310 2 года назад
nice, i was looking for this video, i was wondering too, do we need state management for nextjs, thanks a lot
@MdARahim
@MdARahim 2 года назад
Wow, you deserve more subscriber. I'm glad that I saw your video on Brad traversy's channel and click on your channel link. One question, how do you grasp different technology so quickly and so elegantly? I wish I was that fast.
@codezero6023
@codezero6023 2 года назад
I love the summary about state managers - use nothing ! I prefer my own singleton services with update methods and a subscription function.
@EricEGunes
@EricEGunes 2 года назад
You are a diamond
@weizhangJustin
@weizhangJustin 2 года назад
我使用的是redux-toolkit,because it's powerful
@dimaandoniev544
@dimaandoniev544 Год назад
Hi Jack! I'm really amazed of quality and content of your videos. Could you make the same video but using next 13 please?
@mukleshossen751
@mukleshossen751 Год назад
sir please make video on how to use rtk query with nextJs
@CV0602
@CV0602 2 года назад
Jack, can you make a video about react tables with typescript?
@PRonYouTube
@PRonYouTube 2 года назад
Loved the video. Watched through all of it? Is your zsh config up on github? Looks nice!
@stavroskefaleas6320
@stavroskefaleas6320 2 года назад
Jack please do more videos for remix run.
@abdurrahmanabu-hijleh6963
@abdurrahmanabu-hijleh6963 2 года назад
I'm planning to watch this later. What are your thoughts on Vercel's own data fetching library SWR?
@jherr
@jherr 2 года назад
I think I should have covered it as well. Hahahaha.
@frankli7035
@frankli7035 2 года назад
Amazing, your videos is way above other's 'tutorial' ....Just one quick question if I didn't use on app level of these state datas, how could I use the context store, or it's a bad idea to do so?
@shaqvinluan8455
@shaqvinluan8455 8 месяцев назад
do you have a content about what vs code extensions do you use? what extension you use to change the font style?
@universalis-b5j
@universalis-b5j 2 года назад
You're awesome!, ^^
@nhplayssudoku4488
@nhplayssudoku4488 Год назад
Great video. Now, do this with nextjs 13 app directory
@jherr
@jherr Год назад
Challenge accepted. ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-OpMAH2hzKi8.html
@nhplayssudoku4488
@nhplayssudoku4488 Год назад
@@jherr Great!!! I was just watching that video. Thanks a lot!!!
@Handle3649
@Handle3649 Год назад
Zustand makes the code so much cleaner compare to redux.
@dennisgonzales9521
@dennisgonzales9521 2 года назад
RTK + RTK Query 🔥
@raheelsiddique1631
@raheelsiddique1631 Год назад
Yeah it's bestest..
@anhvuuc8693
@anhvuuc8693 2 года назад
Zustand is the BESTTTTTTT
@claus4tw
@claus4tw 2 года назад
If I get this right I could also store the json in a singleton and pull that in. This gets a lot more complicated with multiple queries where I would opt into react-query. But I still don’t see the case for a statemanager like Zustand. Wouldn’t that make only sense when we want to use for example the filtered list in a different route?
@lyricsmint567
@lyricsmint567 2 года назад
Hello Jack, awesome video.. can you make content on react native.?
@suthanharihara
@suthanharihara 2 года назад
Could you please make a video on handling searching/filtering (across the entire set of items) incase of using SSR in nextJS with pagination of say hundreds of items.
@jampy42
@jampy42 Год назад
Great video, but there is a way to get initial info from api only 1 time instead of each page? like a global state that's been set in server side, and that can also be updated when you build the app, and so that i can access from any component in my app
@LuisLopezCool
@LuisLopezCool 11 месяцев назад
Hey man! amazing work. I wondering what is your zsh theme?
@jherr
@jherr 11 месяцев назад
oh-my-posh with the atomic theme. font is JetBrainsMono NF.
@LuisLopezCool
@LuisLopezCool 11 месяцев назад
@@jherr thanks
@ricardoolartepuell2011
@ricardoolartepuell2011 2 года назад
Great vídeo! I'm now trying to decide between jotai, zustand or recoil for a growing proyect! On the other hand, how You config Your iterm2 like that!!?
@jherr
@jherr 2 года назад
gist.github.com/jherr/cb8770e2ae92a7646d22c126be896a72
@cra2yjoker
@cra2yjoker 2 года назад
12:07 wow.. how did you do that? Nest the pokemon component into PokemonProvider that quickly?
@jherr
@jherr 2 года назад
Sorry, that's just an edit. :( If you find something that does work that quickly please let me know.
@jonathanarturo
@jonathanarturo 2 года назад
What are your toughts using SWR + somestate management? Reasoning behind is the next team (Vercel) recommend it for data fetching on client side, would it make more sense to use just react query?
@spongebob93lover
@spongebob93lover Год назад
i am very curious on that as well, what do you think after 1 year?
@fullstack_journey
@fullstack_journey Год назад
Since NextJS 13 is out... how to do global client side state management now using the app/layout.js file, as i've understood it pre-renders it on the server, will that cause any issues if i put my context providers in there, or what is the better approach to follow for this problem?
@jherr
@jherr Год назад
If you put your context provider at the layout level then none of your components will be RSCs.
@johndevnoza4223
@johndevnoza4223 8 месяцев назад
Hey i love your videos, since im junior not sure if what im going to say is right so im interested about your opinion, so this video is 1year before. And in this one year nextjs changed much i would say, so do u think this video ll apply for todays nextjs? Thanks
@ToddDunning
@ToddDunning 2 года назад
As someone who wants to see you hit a million subs, have you been able to gauge how much growth you get from the legacy stuff?
@jherr
@jherr 2 года назад
Like the older videos? I'm thinking about taking them out of the rotation.
@jherr
@jherr 2 года назад
BTW, any ideas you have towards that 1M subs goal, I'm all ears. :)
@wardxela
@wardxela Год назад
Awesome comparison video, I like it. Thanks for you content. But I want to leave a note regarding Zustand implementation. There is actually a little bug that is related to hydration. Let me explain the problem. 1. When you open the page, getServerSideProps gets called and it saves data to the store and passes it as a prop to our page. 2. Then our page component gets rendered on the server and it receives data from the store, not from useEffect (since it is ignored on the server side). Therefore we implemented SSR. 3. Finally, we render our page on the client. Here is where the problem comes in. First we are trying to get the data from the store and of course there is nothing for now because server side store has nothing common with client side one. So our page renders nothing and we receive a hydration error. Then in useEffect we simply fill the data from the prop causing our page component to rerender, showing us a list of pokemon. It might look that everything is working but hydration requires us to create exact same html on the client that we received from the server on the first render. Possible dumb implementation to fix this might look like this: (filteredPokemon.length === 0 ? pokemon : filteredPokemon).slice(0, 20).map(() => ) A better way to do it is to simply replace filteredPokemon with null in the store when it is first created. P.S. I noticed that the same issue also related to Mobx and RxJS implementations.
@AbdelhameedG
@AbdelhameedG 2 года назад
Great tutorial as usual Jack , I'm in the use-context part 13:11 you say if you add more pages you have to use the same "getServerSideProps" , my question is , in that case , why not use "getInitialProps" in _app instead of calling "getServerSideProps" in every page ?
@AbdelhameedG
@AbdelhameedG 2 года назад
Redux looks so ugly next to all these easier alternatives, I just started a new application at work using next.js and used redux to manage authentication state ( I save user JWT token as a cookie, use it on the server -getInitalProps- to fetch user data and populate redux state with authentication state and it was challenging to make this work ) but now I'm thinking of removing redux completely and going for something else
@AbdelhameedG
@AbdelhameedG 2 года назад
Jack seriously you are Amazing , Thank you for this very high quality tutorials you offer us for free! Thank you sir.
Далее
Mastering React Context: Do you NEED a state manager?
37:26
Next.js with a separate server - good idea?
22:53
Просмотров 63 тыс.
LOLLIPOP-SCHUTZ-GADGET 🍭 DAS BRAUCHST DU!
00:28
Making React Context FAST!
33:34
Просмотров 88 тыс.
Modern Data Fetching in React (Complete Guide)
16:41
Просмотров 51 тыс.
State Managers Are Making Your Code Worse In React
13:33
Picking From 20 React State Managers
35:18
Просмотров 85 тыс.
How NextJS REALLY Works
28:25
Просмотров 149 тыс.
The Most Underrated State Management Tool in React
23:35
NextJS 12.1 SSR & SSG: Everything you need to know
31:18