Engrain by ByteRush

RCT.04 4 concepts · 4 ready

Effects in depth

Write correct effects, and avoid effects that should not exist.

  1. RCT.04.01Effects synchronise with external systemsCoreMid-level11 min
  2. RCT.04.02You might not need an effectCoreMid-level10 min
  3. RCT.04.03Stale closures, dependencies and effect eventsCoreMid-level11 min
  4. RCT.04.04Fetching in effects correctlyCoreMid-level11 min

Interview questions in this module

  1. What is a stale closure in React? Show an example and fix it.
  2. When does the effect cleanup function run?
  3. Give examples of effects you should remove.
  4. How do you prevent race conditions when fetching data in an effect?
  5. What is useEffectEvent for?
  6. Why is useEffect with an empty array not the same as componentDidMount?