this video is a little bit confusing it talks about how React component should be a pure function which should not have side effects outside the render phase
and in some cases we may need to do all the following as the video mentioned
The use effect hook in components is used to cause side effects. A pure component is one which depends only on its inputs. Given an input, it produces the same result. However, since in effect hook, we call the backend to get data, our component now depends on data from the backend. The function can only be pure if the data is passed to it as props. If we have the effect hook in a function, the component becomes impure
You can simply look that online.
The instructor also stress on benefit as it eliminate ambiguity. They are straightforward ie the out put is very predictable.
Pure
function sum(a, b, c){
return a + b +c
}
Impure
Let c = 2;
function sum(a, b){
return a + b + c
}
Here our sum fn know nothing about c until during add operation and c is affecting the result we are getting
Now consider c as useEffect hook that is getting data outside our functional component. We dont have confidence on the data its getting and that make the out unpredictable