
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.
AI Snips
Chapters
Transcript
Episode notes
useReducer and Redux Parallels
useReducermirrors 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.
Wes's useRef Discovery
- Wes discovered that
useRefcan store temporary data, not just DOM nodes. - He used it to track render counts within a
ResizeObserverhook to prevent infinite loops.
Simplify Global State with useContext
- Leverage
useContextfor 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.
