-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUseEffectQuiz.txt
26 lines (19 loc) · 952 Bytes
/
UseEffectQuiz.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
1. What is a "side effect" in React? What are some examples?
- Any code that affects an outside system.
- local storage, API, websockets, two states to keep in sync
2. What is NOT a "side effect" in React? Examples?
- Anything that React is in charge of.
- Maintaining state, keeping the UI in sync with the data,
render DOM elements
3. When does React run your useEffect function? When does it NOT run
the effect function?
- As soon as the component loads (first render)
- On every re-render of the component (assuming no dependencies array)
- Will NOT run the effect when the values of the dependencies in the
array stay the same between renders
4. How would you explain what the "dependecies array" is?
- Second paramter to the useEffect function
- A way for React to know whether it should re-run the effect function
not now
Hustle jaary hain. Allah help me..
HeriThreads is the new website I am gonna build unfortunaltely not todya