The goal from this discussion is to solidify your understanding about useEffect after studying about it before the class and in the class.
Please discuss the following questions between you and answer them in the comment section below.
Questions:
- What is
useEffect
? - What do we mean when we say that useEffect is a hook?
- useEffect gets executed in 3 different ways, what are they? (Adding code examples would be beneficial)
Bonolo and Wesley
useEffect(() =>{
fetchPost });
The above code renders all the time
useEffect(() =>{
fetchPost }, [ ]);
The above code renders once
useEffect(() =>{
fetchPost }) [ condition];
The above code only renders when the condition in the square brackets is true