Introduction to React Recoil (Experimental) State Management

Поділитися
Вставка
  • Опубліковано 12 вер 2024

КОМЕНТАРІ • 64

  • @rodolphobravo298
    @rodolphobravo298 4 роки тому +7

    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 2 роки тому

    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.

  • @landonschlangen
    @landonschlangen 4 роки тому +6

    Wow, Recoil seems amazing! Way better than Redux.

    • @leighhalliday
      @leighhalliday  4 роки тому +2

      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.

  • @eduardohidalgo5260
    @eduardohidalgo5260 4 роки тому +1

    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 роки тому +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 роки тому +1

      @@leighhalliday i'll be waiting for ✌️

  • @chengjinfei8139
    @chengjinfei8139 2 роки тому +2

    better 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!

  • @frozenplatina7652
    @frozenplatina7652 4 роки тому +1

    Nice guide man, btw is that One Monokai theme I see? ;D

  • @harshuuu1852
    @harshuuu1852 2 роки тому

    After reloading the page, atom's state value becomes to it's default value, not what we had changed.

  • @aramisCC10
    @aramisCC10 3 роки тому

    Great video!!!

  • @fernando9206
    @fernando9206 3 роки тому

    You won a subscriber, good content

    • @leighhalliday
      @leighhalliday  3 роки тому

      Excellent! Happy to have you on board, Fernando!

  • @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 роки тому +1

      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.

  • @lakmalp
    @lakmalp 3 роки тому

    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  3 роки тому +2

      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 3 роки тому

      @@leighhalliday Thanks for the reply and looking forward to see quality content like this in the future 🙂

  • @larube
    @larube 4 роки тому

    Geat !
    Muchas Gracias Leigh !

  • @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!

  • @lord4791
    @lord4791 3 роки тому

    I dont understand why did we use selector instead of useRecoilValue of the atom directly?
    Wouldnt that do the same job?

  • @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!

  • @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 роки тому +1

      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" 👍🏼

  • @ms77grz
    @ms77grz 2 роки тому

    🌶🌶===👍👍

  • @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.

  • @PeterKellner99
    @PeterKellner99 3 роки тому

    Curios why you need object.entries. Can’t you iterate over the JavaScript array directly?

    • @leighhalliday
      @leighhalliday  3 роки тому

      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

  • @cizixap129
    @cizixap129 4 роки тому +1

    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.

  • @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 роки тому +1

      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: ua-cam.com/video/i_k7oFcXG6g/v-deo.html

  • @berlino5563
    @berlino5563 4 роки тому

    But can i work in production with recoil? What do you think?

    • @leighhalliday
      @leighhalliday  4 роки тому +2

      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!

  • @hansschenker
    @hansschenker 2 роки тому

    If you use Typescript for static typing you don't get the error: NaN!!!

  • @OussamaBouguerne
    @OussamaBouguerne 4 роки тому

    What about RecoilRoot? What is it used for ?

    • @leighhalliday
      @leighhalliday  4 роки тому +3

      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!

  • @seanknowles5309
    @seanknowles5309 3 роки тому

    how do you get the spicy pepper lol

    • @leighhalliday
      @leighhalliday  3 роки тому

      Haha this one? 🌶 It's just an emoji on the mac. ctrl + option + space to bring up the menu

  • @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.

  • @ГенаПетров-н5ы
    @ГенаПетров-н5ы 4 роки тому

    Get NaN, use TS

    • @leighhalliday
      @leighhalliday  4 роки тому +3

      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 :)

  • @marcodalborgo
    @marcodalborgo 4 роки тому

    Great video!