React Recoil / Recoil js - All you need to know | React tutorial

  Рет қаралды 13,670

Closure: Web Dev. & More

Closure: Web Dev. & More

Күн бұрын

Пікірлер: 51
@ClosureWebDevMore
@ClosureWebDevMore 4 жыл бұрын
How do you like Recoil so far? Do you think it could fully replace Redux one day? 🤔
@deusex8576
@deusex8576 4 жыл бұрын
When multiple users work simultaneously with one document (like google docs), I think it's easier to use redux to stream actions through middlewares. How to send deltas with recoil?
@aaronely759
@aaronely759 3 жыл бұрын
@@deusex8576 Ive had luck with using websockets to transmit events that get filtered through a switch statement by event id to perform the necessary recoil state operations and broadcast the changes to all connected users if necessary-- or not depending on the event. But I suppose there are limitations to this, and it may not apply in your case.
@aaronely759
@aaronely759 3 жыл бұрын
So far I really enjoy using Recoil and don't plan on using an alternative unless I ABSOLUTELY have to.
@solomonogbodo4163
@solomonogbodo4163 4 жыл бұрын
This is the most descriptive recoil tutorial I had ever seen. Thanks a lot.
@ClosureWebDevMore
@ClosureWebDevMore 4 жыл бұрын
Thank you so much :)
@elephant_888
@elephant_888 4 жыл бұрын
@solomon ogbodo - I second that opinion. Much better examples than the ones in the docs! 👌🏽👍🏽
@showingsoftwarebugs5963
@showingsoftwarebugs5963 2 жыл бұрын
Thanks. I was watching a previous video and they only showed atoms and it immediately gave me a bad first impression for the exact reason you showed at 4:42. Thanks for including the selectors in this tutorial.
@DEVDerr
@DEVDerr 4 жыл бұрын
Woaw, it's much better tutorial than Recoil's author presentation itself. Good job mate!
@icfantv
@icfantv 4 жыл бұрын
Kudos for specifically calling out the use of `useRecoilValue` and `useSetRecoilState`. I think it bears mentioning that, per the docs, the latter is recommended for components who intend to write to state without reading it because using this particular hook will prevent the component from subscribing to updates for that particular piece of state (which will prevent unnecessary renders).
@kroloskar
@kroloskar 3 жыл бұрын
Thank you for great tutorial! Would be nice if you made one with all the advanced features...
@6little6fang6
@6little6fang6 3 жыл бұрын
This is video right here, amazing.
@gwapster13
@gwapster13 4 жыл бұрын
This is an excellent walkthrough of what Recoil can do. Bravo. As for it replacing Redux, mobX, etc... I don't think so. While it's rather effective at solving specific problems, it doesn't necessarily cover everything that all those other popular state management libs excel at doing. So really it just gives us additional choice, depending on the specific needs/application.
@ClosureWebDevMore
@ClosureWebDevMore 4 жыл бұрын
Thank you for the kind words, Arnel! And I have to agree with you on that. At the moment , Recoil looks more like an alternative rather than a competitor. What’s interesting to me is where will Recoil be in a year or so! I think the team could easily make it a solid choice for small-mid scale projects. We’ll see!
@RabeeRaad
@RabeeRaad 4 жыл бұрын
Wow, very helpful. Thanks for sharing.
@ClosureWebDevMore
@ClosureWebDevMore 4 жыл бұрын
I'm glad you liked it! :)
@TehLostGamers
@TehLostGamers 4 жыл бұрын
Great video! Thank you. Recoil seems like a fast way for state management but it might get messy in big projects.
@noahsigel3529
@noahsigel3529 3 жыл бұрын
Great video
@musaid
@musaid 3 жыл бұрын
Awesome tutorial. Thanks.
@Nyasha_Nziboi
@Nyasha_Nziboi 4 жыл бұрын
cheers for sharing
@UIGems
@UIGems 4 жыл бұрын
really helpful! Subd! expecting more vdos
@madebydor
@madebydor 4 жыл бұрын
Really great tutorial, thanks a lot. I fell in love with Recoil! Quick question - assuming I'm loading a list of articles using `useRecoilValueLoadable`, how can I fetch the articles again from the server? Right now, it only fetches it the first time the component was loaded, and then pulls the data from the state.
@jamesjohnson5386
@jamesjohnson5386 4 жыл бұрын
switch actually makes sense
@ClosureWebDevMore
@ClosureWebDevMore 4 жыл бұрын
It does make sense, I agree on that. It just gives me Redux vibes with a 10-condition switch-case in a reducer. This is not critical, since other options are available, but it could have been better, in my opinion
@SuperAdilMorocco
@SuperAdilMorocco 2 жыл бұрын
nice video ever
@dijup
@dijup 2 жыл бұрын
while fetching data from server can we use react-query to get the data
@ideologic3407
@ideologic3407 3 жыл бұрын
How do I prevent elements from rerendering if the recoil state of the atom is changed?
@muneugi3900
@muneugi3900 2 жыл бұрын
Hi requesting for a refresher on Recoil in 2022 together with use cases
@dijup
@dijup 2 жыл бұрын
can we use react query to fetch the data
@TheDorac1
@TheDorac1 8 ай бұрын
Here we are, a few years later, and it seems to be abandoned.
@connygu
@connygu 4 жыл бұрын
Hi Thanks, a really great tutorial about recoil, short but very clear! I will try recoil now! 👍
@ClosureWebDevMore
@ClosureWebDevMore 4 жыл бұрын
I’m glad you liked it! :) Definitely try this out, so much fun
@connygu
@connygu 4 жыл бұрын
Hi I just learned your example, everything works smoothly. Until there is a last problem. I found that if you async load one article, it will fetch the data 4 times during "loading" state. I made a sandbox code example and changed the code a little, so it will print the fetched data in console: codesandbox.io/s/recoil-loading-problem-ebmc4?file=/src/ArticleList/ArticleList.component.js Can you take a look? After running the page, just watch the console. It will show you 4 times fetched data. Do you know why?
@ClosureWebDevMore
@ClosureWebDevMore 4 жыл бұрын
Hey Conny! This has to do with the React core itself. If you try defining a regular useState hook, you will see that the component renders twice. And if the application is wrapped inside of component (which is the case for this tutorial, check index.js file), React triggers every re-render twice to help catch bugs. So it's 2 re-renders per hook multiplied by two due to Strict Mode and 4 in total! Don't worry, this is the expected behavior! :)
@codingamer373
@codingamer373 2 жыл бұрын
is Recoil a compatible choice for a Next 13 project?
@Timur21
@Timur21 4 жыл бұрын
i dont understand how I would update an article for example.. Like an async set that would first update an article and then fetch them all again.
@ms77grz
@ms77grz 2 жыл бұрын
👍👍
@walkawelk
@walkawelk 4 жыл бұрын
in recoil-tutorial/src/shared/ globalState is missing
@ClosureWebDevMore
@ClosureWebDevMore 4 жыл бұрын
Totally missed that. Thanks for letting me know, fixed now!
@milansingh3222
@milansingh3222 4 жыл бұрын
Can we use along with redux where we have functional component?
@ClosureWebDevMore
@ClosureWebDevMore 4 жыл бұрын
I haven’t tried that, but it should work fine
@creative-commons-videos
@creative-commons-videos 4 жыл бұрын
what about mutation ? onclick i want to send post request on server
@nhathuynguyen716
@nhathuynguyen716 4 жыл бұрын
Do you think context api + recoil can beat redux ?
@ClosureWebDevMore
@ClosureWebDevMore 4 жыл бұрын
I wouldn’t combine Recoil and Context API, because they do the same thing. As for Redux, I believe that Recoil has the potential to be the go-to solution for small/mid projects, but for large Redux is probably going to be the king still. Mainly because Redux is an industry standard and a proven library. Recoil is just way too new for that (at least for year 2020)
@nhathuynguyen716
@nhathuynguyen716 4 жыл бұрын
@@ClosureWebDevMore Hey thanks for the detailed answer! Probably using Recoil over Context Api :)
@Jackchen-qr7hq
@Jackchen-qr7hq 3 жыл бұрын
redux won't re-render whole Dom tree...
@ClosureWebDevMore
@ClosureWebDevMore 3 жыл бұрын
It won’t do that by itself, but if the redux state has changed and a component was listening to the changed property, all of that component’s children are being re-rendered. PureComponent fixes that, but on the surface Recoil is much efficient at preventing unnecessary re-renders
@amobism
@amobism 10 ай бұрын
@@ClosureWebDevMore So if we have component A, that has some children. And A uses redux state through a useSelector hook. If the state changes then component A must re-render and then react will also render all its children unless they are PureComponents or uses React.memo. But if we change component A to use recoil instead and the atom containing the state that component A subscribes to changes. Component A must also re-render but for "magic" reasons, the children will now not re-render? That sounds, magical.
Introduction to React Recoil (Experimental) State Management
27:50
Leigh Halliday
Рет қаралды 11 М.
Recoil Tutorial | React State Libraries
11:12
Ian Lenehan
Рет қаралды 18 М.
Хаги Ваги говорит разными голосами
0:22
Фани Хани
Рет қаралды 2,2 МЛН
Why use Recoil in React? | Atoms and Selectors
13:09
CBT Nuggets
Рет қаралды 4,8 М.
Bring Life to Your Website | Parallax Scrolling using React and CSS
4:12
Closure: Web Dev. & More
Рет қаралды 89 М.
Learn React With This One Project
42:38
Web Dev Simplified
Рет қаралды 851 М.
Props vs Context vs Redux vs Recoil | React State Management
18:31
Redhwan Nacef
Рет қаралды 6 М.
How to use Recoil for state management in ReactJS or NextJS
14:32
Intro to Recoil - A great new Redux alternative? | Tutorial Video
16:22
Gitlab DELETING Production Databases | Prime Reacts
17:27
ThePrimeTime
Рет қаралды 361 М.
Recoil.js for Beginners - A Quick Start Guide
10:14
Kristian Freeman
Рет қаралды 52 М.
Хаги Ваги говорит разными голосами
0:22
Фани Хани
Рет қаралды 2,2 МЛН