Syntax - Tasty Web Development Treats

React Hooks - 1 Year Later

Mar 18, 2020
The hosts celebrate the one-year anniversary of React Hooks and delve into their transformative impact on web development. They compare Hooks to the older render props method, emphasizing their superior readability. Key hooks like useState and useEffect take the spotlight for their state management capabilities. The discussion includes insights into error handling with tools like Sentry, alongside light-hearted anecdotes about technology mishaps involving kids. Listeners also get tips on optimizing code organization with Babel and crafting effective custom hooks.
Ask episode
AI Snips
Chapters
Transcript
Episode notes
INSIGHT

useReducer and Redux Parallels

  • useReducer mirrors Redux principles by returning new state objects based on dispatched actions.
  • It offers more control and complexity compared to useState, handling multiple value changes effectively.
ANECDOTE

Wes's useRef Discovery

  • Wes discovered that useRef can store temporary data, not just DOM nodes.
  • He used it to track render counts within a ResizeObserver hook to prevent infinite loops.
ADVICE

Simplify Global State with useContext

  • Leverage useContext for managing global application state, like UI elements or loading states, separate from data in Apollo's cache.
  • Create custom hook wrappers for cleaner context management.
Get the Snipd Podcast app to discover more snips from this episode
Get the app