Introduction to React Recoil (Experimental) State Management

  Рет қаралды 11,152

Leigh Halliday

Leigh Halliday

Күн бұрын

Пікірлер: 64
@chengjinfei8139
@chengjinfei8139 3 жыл бұрын
better than context.
@rodolphobravo298
@rodolphobravo298 4 жыл бұрын
You are the best!! Thank you so much for sharing your knowledge!!
@leighhalliday
@leighhalliday 4 жыл бұрын
Thank you Rodolpho! Glad you enjoyed the video!! I have another one on the way later this week that I'm going to record right now, also about Recoil.
@liu-river
@liu-river 3 жыл бұрын
Thanks Leigh, you always explain things so well in your videos. Recoil seems very easy to grasp, way more comprehensive than Redux and less code than Context.
@Norfeldt
@Norfeldt 4 жыл бұрын
I did enjoy this video (as well as many of your other great ones). I have been using the react Context for quite some time now and couldn't stop thinking that the same could be archived by having a lot of different contexts and then make one provider that provides them all at the root of the app.
@leighhalliday
@leighhalliday 4 жыл бұрын
Thank you :) I think that works when you know how many providers you need... if it is unknown/dynamic, would be hard to get right!
@larube
@larube 4 жыл бұрын
Geat ! Muchas Gracias Leigh !
@leighhalliday
@leighhalliday 4 жыл бұрын
Con mucho gusto, Amador!
@eduardohidalgo5260
@eduardohidalgo5260 4 жыл бұрын
Pls continue this series about Recoil! I Really want to see how you use Recoil.js as persisting layer, and how you integrate with fetch and state of component lifecycle (: I love your content!
@leighhalliday
@leighhalliday 4 жыл бұрын
Thanks for the ideas Eduardo! I'm doing another video right now doing some experimenting with draggable squares that calculate dynamic bounding boxes... hopefully it'll be cool 😎
@eduardohidalgo5260
@eduardohidalgo5260 4 жыл бұрын
@@leighhalliday i'll be waiting for ✌️
@landonschlangen
@landonschlangen 4 жыл бұрын
Wow, Recoil seems amazing! Way better than Redux.
@leighhalliday
@leighhalliday 4 жыл бұрын
I agree, but I pretty much like everything more than Redux haha. Some things just click better for me than others, and Recoil is definitely one of those.
@fernando9206
@fernando9206 4 жыл бұрын
You won a subscriber, good content
@leighhalliday
@leighhalliday 4 жыл бұрын
Excellent! Happy to have you on board, Fernando!
@frozenplatina7652
@frozenplatina7652 4 жыл бұрын
Nice guide man, btw is that One Monokai theme I see? ;D
@leighhalliday
@leighhalliday 4 жыл бұрын
You see correctly :)
@marcodalborgo
@marcodalborgo 4 жыл бұрын
Great video!
@leighhalliday
@leighhalliday 4 жыл бұрын
Thank you Marco!
@ridl27
@ridl27 4 жыл бұрын
ty. looks like Recoil is really pretty good tool.
@leighhalliday
@leighhalliday 4 жыл бұрын
I enjoyed putting the videos together! Give it a try!
@Daniel-wx9wz
@Daniel-wx9wz 4 жыл бұрын
Great video! Have you tried Zustand by any chance?
@leighhalliday
@leighhalliday 4 жыл бұрын
I haven't :D Another thing to add to my list! Thanks for sharing!
@lakmalp
@lakmalp 4 жыл бұрын
A very informative video. Please do keep them coming. A question popped to my mind right now is how it would be like to manage form data with dozens of input fields. Should I create an atom for each input or should I have a single atom with all the data in it?
@leighhalliday
@leighhalliday 4 жыл бұрын
Hey Lakmal! Great question... honestly for large forms I would look to use something like react-hook-form. Specific to your question, I'm honestly not sure :D I would choose whichever way you prefer, and only worry if you run into any performance issues. I always favour the develop first, and only worry about performance if it becomes an issue.
@lakmalp
@lakmalp 4 жыл бұрын
@@leighhalliday Thanks for the reply and looking forward to see quality content like this in the future 🙂
@harshuuu1852
@harshuuu1852 3 жыл бұрын
After reloading the page, atom's state value becomes to it's default value, not what we had changed.
@ms77grz
@ms77grz 2 жыл бұрын
🌶🌶===👍👍
@lord4791
@lord4791 3 жыл бұрын
I dont understand why did we use selector instead of useRecoilValue of the atom directly? Wouldnt that do the same job?
@shezzor
@shezzor 4 жыл бұрын
Looks interesting. I know this is just an introduction to Recoil but I suppose if you are going to build such a simple low-frequency state change app, it's probably better to just stick with Context.
@leighhalliday
@leighhalliday 4 жыл бұрын
You're probably right, but it has a pretty nice feel to it... I almost prefer it over having to create my own context provider! I have another video coming this week that shows a higher frequency state change app.
@oscarah317
@oscarah317 4 жыл бұрын
Nice intro to Recoil, could you tell which is the plugin you use for the emoticons and which is the extension to see the renderings? Thanks for sharing knowledge.
@leighhalliday
@leighhalliday 4 жыл бұрын
Hey Oscar! I think it's just whatever comes by default on the mac.
@oscarah317
@oscarah317 4 жыл бұрын
Windows guy here 😂😂😂, I'll see if there's some plugin, waiting for the next video, enjoy the "mate" 👍🏼
@PeterKellner99
@PeterKellner99 4 жыл бұрын
Curios why you need object.entries. Can’t you iterate over the JavaScript array directly?
@leighhalliday
@leighhalliday 4 жыл бұрын
Hey Peter! If it's object.entries, that looks like I'm iterating over an object, not an array... I think I stored things in an object in this video... can't remember though :D
@les2997
@les2997 4 жыл бұрын
Better than MobX? Do you have an opinion after working with both?
@leighhalliday
@leighhalliday 4 жыл бұрын
Better is subjective... I guess it depends on what you prefer and your use-case. I love MobX too!
@les2997
@les2997 4 жыл бұрын
@@leighhalliday MobX clones objects when it creates observables and then clones them again by calling toJS. Recoil doesn't clone objects. I like MobX, but I'm a little bothered by the cloning part.
@garikdjan6266
@garikdjan6266 3 жыл бұрын
It seems to me that this is not a completely correct example. Why is the entire list constantly redrawn? After all, we change the state of one item in the list with the add button. Perhaps every element must be an atom. Or somehow get through the key selector...
@leighhalliday
@leighhalliday 3 жыл бұрын
Hey Garik! I think you're right, here's another example I did where I split things up into individual atoms to solve this issue: kzbin.info/www/bejne/n5DOaKJ8mL16bMk
@berlino5563
@berlino5563 4 жыл бұрын
But can i work in production with recoil? What do you think?
@leighhalliday
@leighhalliday 4 жыл бұрын
If you consider yourself an adventurous person, yes. But it may change in the future so prepare to refactor some of your code.
@berlino5563
@berlino5563 4 жыл бұрын
Leigh Halliday oh I agree :) thank you for your videos!
@OussamaBouguerne
@OussamaBouguerne 4 жыл бұрын
What about RecoilRoot? What is it used for ?
@leighhalliday
@leighhalliday 4 жыл бұрын
It's acting as a "Context Provider"... similar to how you need a provider with useContext, MobX, Redux, Apollo, etc... something high level in the component tree that can share context (our state) with the rest of the components below.
@OussamaBouguerne
@OussamaBouguerne 4 жыл бұрын
@@leighhalliday That's what I thought, thanks for replying to my comment and confirming my suspicion. Keep up the good work!
@cizixap129
@cizixap129 4 жыл бұрын
Recoil good for data reading, but developers are still trying to figure out the API for update
@leighhalliday
@leighhalliday 4 жыл бұрын
Have you tried it on any apps yet? I've just been playing around with it this weekend, so nothing serious yet.
@seanknowles5309
@seanknowles5309 4 жыл бұрын
how do you get the spicy pepper lol
@leighhalliday
@leighhalliday 4 жыл бұрын
Haha this one? 🌶 It's just an emoji on the mac. ctrl + option + space to bring up the menu
@PS-dp8yg
@PS-dp8yg 4 жыл бұрын
Sweet! I don't like Redux, and I don't like Mobx. This seems a better option when it is ready. At my job, we use both redux and mobx in the same project. We used Redux for our global state, and we use Mobx as if it is local state. We only use Mobx for our forms since our forms are too complex. Biggest mistake ever was to use redux-form for our forms.
@leighhalliday
@leighhalliday 4 жыл бұрын
Hehe... yea I find a lot of Redux/MobX is just preference eh? I'm a big fan of react-hook-form for managing forms... but Formik is awesome too!
@PS-dp8yg
@PS-dp8yg 4 жыл бұрын
@@leighhalliday We looked into those, but nothing worked for our scenario. Our forms are way too complex for those libraries, so we decided to use just local state for our new forms.
@whitetommy5559
@whitetommy5559 4 жыл бұрын
This may replace the react state!!
@leighhalliday
@leighhalliday 4 жыл бұрын
I don't think it would need to replace local component state, but it is an option to replace sharing state via context providers, mobx, redux, etc... the "global state" parts of your app.
@hansschenker
@hansschenker 2 жыл бұрын
If you use Typescript for static typing you don't get the error: NaN!!!
@ГенаПетров-н5ы
@ГенаПетров-н5ы 4 жыл бұрын
Get NaN, use TS
@leighhalliday
@leighhalliday 4 жыл бұрын
I love TS, but generally avoid it for videos because it adds some extra complexity when explaining a new concept. You're right, here it woulda saved me :)
@aramisCC10
@aramisCC10 3 жыл бұрын
Great video!!!
@leighhalliday
@leighhalliday 3 жыл бұрын
Thank you Aramis!
React Recoil / Recoil js - All you need to know | React tutorial
17:11
Closure: Web Dev. & More
Рет қаралды 13 М.
I Tried 5 Redux Alternatives and Here is the Best one
16:48
CoderOne
Рет қаралды 23 М.
Мен атып көрмегенмін ! | Qalam | 5 серия
25:41
黑天使被操控了#short #angel #clown
00:40
Super Beauty team
Рет қаралды 61 МЛН
Recoil For React JS - Complete Crash Course 2023
32:43
Code Ryan
Рет қаралды 10 М.
React Query Is (Still) Essential - My Favorite React Library
11:04
Theo - t3․gg
Рет қаралды 160 М.
Why use Recoil in React? | Atoms and Selectors
13:09
CBT Nuggets
Рет қаралды 4,9 М.
All useEffect Mistakes Every Junior React Developer Makes
22:23
Picking From 20 React State Managers
35:18
Jack Herrington
Рет қаралды 86 М.
How to use Recoil for state management in ReactJS or NextJS
14:32
Reduce: 10 Different Examples. JavaScript Fundamentals.
26:57
Leigh Halliday
Рет қаралды 29 М.
React Query: It’s Time to Break up with your "Global State”! -Tanner Linsley
29:01
React Conferences by GitNation
Рет қаралды 142 М.
Мен атып көрмегенмін ! | Qalam | 5 серия
25:41