Potasse

SDE-II

An onsite in fifty cards: React live coding and system design. State and effects, async JavaScript, Postgres, caching, API security and how to argue a trade-off, each checked against React's docs, Vercel's skills, GreatFrontEnd, OWASP and the System Design Primer.

Try a card

SDE-II1 of 3

Why should derived state usually not be stored in useState?

Say it in your head first.

Questions

  1. 01Why should derived state usually not be stored in useState?
  2. 02When can a data-fetching useEffect cause a race condition, and how do you fix it?
  3. 03How do you reset all of a component's state when a prop like userId changes?
  4. 04Why is the array index a bad key for a list that can be reordered, filtered or prepended to?
  5. 05A click handler calls setCount(count + 1) three times. By how much does count grow, and why?
  6. 06Should state hold the selected item object or its id?
  7. 07A form has isSending and isSent booleans. What's wrong, and what replaces them?
  8. 08Why must you never declare a component inside another component's body?

…and 42 more cards. The answers are yours to find.