Debugging
Exercises on React and JavaScript gotchas that often come up in interviews.
- State & closureThe "stale closure" interview example: why count freezes at 0, and how to fix it with dependencies, functional updates, or refs.
- Type-safe data fetcherGeneric function to fetch a property from an object: fix the key–object type relationship with keyof and generic constraints.
- Discriminated unionsNarrow API response types with a discriminant (e.g. status) so you only access properties that exist on each variant.