ReactJs Tutorial - 09 - useEffect with Fetch explained in Tamil - 2023 #reactjstutorial #tamil

preview_player
Показать описание
The useEffect Hook allows you to perform side effects in your components.

Some examples of side effects are: fetching data, directly updating the DOM, and timers.

useEffect accepts two arguments. The second argument is optional.

useEffect(function, dependency)

useEffect runs on every render. That means that when the count changes, a render happens, which then triggers another effect.

This is not what we want. There are several ways to control when side effects run.

We should always include the second parameter which accepts an array.

We can optionally pass dependencies to useEffect in this array.

So, to fix this issue, let's only run this effect on the initial render.

If there are multiple dependencies, they should be included in the use effect dependency array.

Effect Cleanup

Some effects require cleanup to reduce memory leaks.

Timeouts, subscriptions, event listeners, and other effects that are no longer needed should be disposed of.

We do this by including a return function at the end of the use effect Hook.

React useEffect with Fetch Explanation - Video Timings:
Рекомендации по теме
Комментарии
Автор

Hi Friends, Sorry for missing that part in the video.

05:31 - Double Negation(!!) - Means - Converting any value to a boolean in simple terms.

For example - if an object or string is available - it will return true, so now the isError becomes true when the value is there in the error object or error message.

frontendkoder_
visit shbcf.ru