No BS TS #26 - Typescript/React - Global State

  Рет қаралды 7,120

Jack Herrington

Jack Herrington

Күн бұрын

Пікірлер: 35
@jackh3242
@jackh3242 3 жыл бұрын
I've been using easy-peasy for global state in my react typescript apps with great results. It's very friendly and minimal!
@jherr
@jherr 3 жыл бұрын
Sounds like my kind of state manager! :)
@align2source
@align2source Жыл бұрын
These days I watch your channel whenever I have a snack while taking a break from my project! Actually much more entertaining than Netflix or HBO 💚🛸✨
@jherr
@jherr Жыл бұрын
Wow! Netflix, ok. But HBO, with HOTD, wow! ;)
@ApurvaShekhar-hn5or
@ApurvaShekhar-hn5or Жыл бұрын
This helped me a lot. concise content.
@jovanaj8365
@jovanaj8365 3 жыл бұрын
This series is a life saver!
@miguelyoutube100
@miguelyoutube100 Жыл бұрын
Thanks for the great video.
@1879heikkisorsa
@1879heikkisorsa Жыл бұрын
Awesome!
@infisspablo8602
@infisspablo8602 Жыл бұрын
Cool stuff
@jamesvo3462
@jamesvo3462 2 жыл бұрын
good stuff
@ivayloyankov8120
@ivayloyankov8120 2 жыл бұрын
I like it.
@robx_001
@robx_001 2 жыл бұрын
awesome
@netvaibhav
@netvaibhav 3 жыл бұрын
Thanks for the great video. react-use looks quite nice and minimal. How does it compare to Valtio?
@jherr
@jherr 3 жыл бұрын
Valtio is a great state manager. But it's doing the observables thing. So it's really a different model, IMHO. This `createGlobalState` is a "spot fix" for when you need state that is ... global. So if you are doing the custom hooks thing, then this would be great for that. But if you are doing more of a state manager approach that is light on hooks, then Valtio or Zustand would be a good choice.
@ДмитроСорока-г5ж
@ДмитроСорока-г5ж Жыл бұрын
Thanks!
@AAquaticAApe
@AAquaticAApe 2 жыл бұрын
Great series!
@higorcoimbra6591
@higorcoimbra6591 2 жыл бұрын
Can you please clarify why the previous solution, using useReducer, was not globally available?
@denilsoncosta9837
@denilsoncosta9837 3 жыл бұрын
normally for this use case i prefer zustand to handle global states. I use for exemple in multi-language cases.
@jherr
@jherr 3 жыл бұрын
:) Zustand is coming up. It's a personal favorite as well.
@denilsoncosta9837
@denilsoncosta9837 3 жыл бұрын
@@jherr I can´t wait!
@PostMeridianLyf
@PostMeridianLyf 2 жыл бұрын
I've been doing Android dev for 2 years and came over to build my first react app. Is it really worth all the hassle to configure global contexts or would it be easier to use a viewmodel? In kotlin I can use a view model with live data that triggers changes in other fragments. I'm not sure if there is an equivalent in React/Ts? I hate being stuck on such a simple issue lol.
@jherr
@jherr 2 жыл бұрын
useState/useReducer would be the equivalent in React.
@PostMeridianLyf
@PostMeridianLyf 2 жыл бұрын
@@jherr I actually figured that out from another video of yours. You are the man! The react-use library set me straight! When I am no longer poor I will buy you a beer!
@PostMeridianLyf
@PostMeridianLyf 2 жыл бұрын
@@jherr I thought I had replied to this already but I guess it did not save. Thank you so much Jack! I learned more about react-use from another one of your videos and it really helped out! One day when i am not poor I will buy you a beer!
@cas818028
@cas818028 3 жыл бұрын
Would useContext be better suited for this example?
@jherr
@jherr 3 жыл бұрын
Everything has pros/cons, but you can be the judge directly if you watch the useContext implementation in the previous episode - kzbin.info/www/bejne/haTIeGulhpeFeq8
@piotr5014
@piotr5014 3 жыл бұрын
I'm doing all the same(I've even copied App and useTodos) and i got an error about invalid hook call when using useGlobalTodos(with no VSC problems appeard)
@jherr
@jherr 3 жыл бұрын
Feel free to jump on the Discord server and see if you can get some help on there.
@aryan7069_
@aryan7069_ Жыл бұрын
I have a question Is not changing state with setState(prev => new) more preferred than setState(new) Then why are you changin states like this
@jherr
@jherr Жыл бұрын
I'm hearing more and more that setState(prev => new) should be used unless absolutely necessary, I'm not sure who is saying that, but it's not me and it's not the React documentation (read the section entitled "Is using an updater always preferred? "). Speaking more generally, if you hear advice that is super boolean (e.g. "Never do it like this."). Or you get advice that is clearly not supported by the official documentation. Then it's probably not great advice.
@adamlerman4173
@adamlerman4173 3 жыл бұрын
comment for the algorithm XD
@mortezatourani7772
@mortezatourani7772 3 жыл бұрын
8:06 The main list didn't update!!! Something went wrong
@jherr
@jherr 3 жыл бұрын
Hot refresh. Ugh.
@hbela1000
@hbela1000 2 жыл бұрын
Thanks for the great video.
@moretimeproductions
@moretimeproductions 2 жыл бұрын
Awesome!
No BS TS #27 -Typescript/React - Redux Toolkit
14:09
Jack Herrington
Рет қаралды 36 М.
No BS TS #28 - Typescript/React - Zustand
9:12
Jack Herrington
Рет қаралды 8 М.
"كان عليّ أكل بقايا الطعام قبل هذا اليوم 🥹"
00:40
Holly Wolly Bow Arabic
Рет қаралды 14 МЛН
Flipping Robot vs Heavier And Heavier Objects
00:34
Mark Rober
Рет қаралды 59 МЛН
Когда отец одевает ребёнка @JaySharon
00:16
История одного вокалиста
Рет қаралды 15 МЛН
🕊️Valera🕊️
00:34
DO$HIK
Рет қаралды 12 МЛН
No BS TS #21 - Typescript/React - Hooks
11:41
Jack Herrington
Рет қаралды 12 М.
No BS TS #25 - Typescript/React - useContext
13:16
Jack Herrington
Рет қаралды 18 М.
No BS TS #33 - Viewer's Q&A (Does Typescript Bloat Code?)
25:51
Jack Herrington
Рет қаралды 5 М.
Vites Fatal Flaw Fixed With Vinxi
11:23
Jack Herrington
Рет қаралды 17 М.
No BS TS #11 - Enums and Literal Types in Typescript
7:39
Jack Herrington
Рет қаралды 18 М.
No BS TS - Challenge 3
19:06
Jack Herrington
Рет қаралды 7 М.
No BS TS #20 - Typescript/React - Setup and Properties
10:45
Jack Herrington
Рет қаралды 13 М.
No BS TS #18 - Conditional Types in Typescript
11:40
Jack Herrington
Рет қаралды 17 М.
"كان عليّ أكل بقايا الطعام قبل هذا اليوم 🥹"
00:40
Holly Wolly Bow Arabic
Рет қаралды 14 МЛН