Chuyển sang chế độ ngoại tuyến với ứng dụng Player FM !
Realigning Your Model of React After Hooks With Dan Abramov
Manage episode 239492334 series 2530175
In this episode, Kent and Dan talk about the ways in which you'll have to reconstruct your mental model of how React works in order to get the hang of hooks, and how hooks more closely align with React's intended model.
React has made multiple attempts at figuring out a way to share state between components. Mixins, higher-order components, render props, and now hooks. Dan Abramov walks through what went right and what went wrong with each of the implementations prior to hooks. None of these implementations lined up with React's model, they were too indirect, or too limiting.
Classes didn't properly fit in with React's component model either. Components don't use inheritance, they aren't ever instantiated, you don't call methods off of them. Dan explains how Components are more like a stateful function, and how Hooks are a closer approximation of this mental model.
Resources
Guest: Dan Abramov
- Twitter: @dan_abramov
- Website: overreacted.io
- GitHub: @gaearon
Host: Kent C. Dodds
- Website: kentcdodds.com
- Twitter: @kentcdodds
- GitHub: @kentcdodds
- YouTube: Kent C. Dodds
- Epic React: epicreact.dev
89 tập
Manage episode 239492334 series 2530175
In this episode, Kent and Dan talk about the ways in which you'll have to reconstruct your mental model of how React works in order to get the hang of hooks, and how hooks more closely align with React's intended model.
React has made multiple attempts at figuring out a way to share state between components. Mixins, higher-order components, render props, and now hooks. Dan Abramov walks through what went right and what went wrong with each of the implementations prior to hooks. None of these implementations lined up with React's model, they were too indirect, or too limiting.
Classes didn't properly fit in with React's component model either. Components don't use inheritance, they aren't ever instantiated, you don't call methods off of them. Dan explains how Components are more like a stateful function, and how Hooks are a closer approximation of this mental model.
Resources
Guest: Dan Abramov
- Twitter: @dan_abramov
- Website: overreacted.io
- GitHub: @gaearon
Host: Kent C. Dodds
- Website: kentcdodds.com
- Twitter: @kentcdodds
- GitHub: @kentcdodds
- YouTube: Kent C. Dodds
- Epic React: epicreact.dev
89 tập
Tất cả các tập
×Chào mừng bạn đến với Player FM!
Player FM đang quét trang web để tìm các podcast chất lượng cao cho bạn thưởng thức ngay bây giờ. Đây là ứng dụng podcast tốt nhất và hoạt động trên Android, iPhone và web. Đăng ký để đồng bộ các theo dõi trên tất cả thiết bị.