Async Fetching made easy with React-Query

preview_player
Показать описание
I try out React-Query by Tanner Linsley in this video. It's a great library for fetching async data with React Hooks.

Support me by subscribing to this channel ❤️



Find me somewhere below:

Рекомендации по теме
Комментарии
Автор

Hey! I noticed that I've had some unintentional reverb on my latest videos. I will remove it for later ones 😃You should be able to hear what I say anyways and no, I'm not in a big airplane hangar recording 😄

Weibenfalk
Автор

Really thanks for the introductory video, usually I use Redux to store a state (data, loading, failure, error) with Saga and axios for async calls, but this library gave me a new fresh view and tooling for my work. There's a similar library optimized for the use with Next.js which is SWR. I'll try not to use create-react-app and Redux for my projects. Thanks again.

marouaniAymen
Автор

Thanks. Please how can you use React Query with redux actions ?

iNovotek
Автор

I have a newbe question - why does the fetchData function has 2x await? ;D

async ( ) => await (await fetch( ... )).json( );

Skia_
Автор

I use this code which I learned from other youtubers:

const fetchPeople = async (key, page) => {
return res.json();
}

const { data, status } = useQuery( ['people', 2 ], fetchPeople ); //page with value of 2

...
...data.results.map(...)
...


and I get errror "Cannot read property 'map' of undefined". I also console.log(page) just to see if it stores value of page which is passed to the 'fetchPeople' function. It also gets undefined.

What is the problem here? Did the creator of useQuery remove its ability to accept parameters/variables in array in recent version?

jumbo
join shbcf.ru