Completed
01:12 Sponsor
Class Central Classrooms beta
YouTube videos curated by Class Central.
Classroom Contents
All 17 React Best Practices
Automatically move to the next video in the Classroom when playback concludes
- 1 00:00 Best practices = Senior dev
- 2 01:12 Sponsor
- 3 03:58 #1 Constants / Hard-coded values / Magic values
- 4 12:03 #2 Folder structure
- 5 16:02 #3 Components: when to create them
- 6 23:42 #4 Avoid unnecessary markup div's
- 7 27:28 #5 IMPORTANT: don't add layout styles to reusable component
- 8 33:30 #6 Use TypeScript why & where in React
- 9 37:07 #7 IMPORTANT: Keep components simple children pattern, updater function for useState
- 10 51:32 #8 IMPORTANT: Don't use setter function from useState, instead create a separate event handler function
- 11 55:43 #9 IMPORTANT: Naming props when prop is a function
- 12 01:02:42 #10 useMemo, useCallback & React.memo for performance
- 13 01:09:12 #11 When to use updater function from useState
- 14 01:11:32 #12 Use single state instead of multiple states
- 15 01:13:15 #13 IMPORTANT: one source of truth in programming. Keep track of a 'selected' or 'active' item by its id, NOT its whole object!
- 16 01:18:18 #14 IMPORTANT: use the URL for some state filters, pagination, etc., not useState
- 17 01:21:37 #15 Keep useEffect simple: one concern per useEffect
- 18 01:26:18 #16 IMPORTANT: instead of fetching data in useEffect, consider alternatives
- 19 01:33:12 #17 IMPORTANT: improve overall structure with components, custom hooks and utility functions
- 20 01:45:50 Outro