Kent Dodds - Advanced hooks

Kent Dodds is a pretty famous (at least in React land) trainer, conference presenter and blogger. Has courses on egghead.io and more

Has a his own training workshop series on react: https://kentcdodds.com/workshops/

I saw he had an online training coming up and really wanted to participate and learn from him. I've worked with hooks such as useEffect and useCallback so I decided to step up to the Advanced Hooks course, more: https://kentcdodds.com/workshops/advanced-react-hooks


I'm leaning advanced hooks myself so my intent is not to teach you how to use these hooks. My intent is to share my experience and the materials to inspire and guide you to learn more yourself.

Do prepare in advance of the course: 

- setup zoom

- his KCD workshop prep

- pre-requisite material

- the coursework itself


Kent moves quickly in his online courses

His intent is not that you learn everything and get all exercises working in the training session. So you have to revisit later

Kent also drops a lot of extra cirricular material, blog posts, libraries etc. so you learn more than just the coursework. Checkout the following list:

Why react hooks: 

  • https://www.recallact.com/presentation/why-react-hooks

  • https://youtu.be/zWsZcBiwgVE?list=PLV5CVI1eNcJgNqzNwcs4UKrlJdhfDjshf

  • "
This is a really cool video that both goes into a bit of how hooks work, and then how useful composition via hooks can be (the second half, with Michael Jackson).
"" https://www.youtube.com/watch?v=1jWS7cCuUXw&t=3327s



Kents egghead course http://kcd.im/refactor-react



React state and usecontext hook

  • https://kentcdodds.com/blog/how-to-use-react-context-effectively

  • https://kentcdodds.com/blog/how-to-optimize-your-context-value

  • https://kentcdodds.com/blog/application-state-management-with-react

  • https://kentcdodds.com/blog/state-colocation-will-make-your-react-app-faster

  • https://kcd.im/colocation


  Q. would you have 1 single context for the app or multiples?

  A. Kent prefers to avoid single global context, he prefers to separate by domain

  such as modal context, other context etc. read more on:

  • https://kentcdodds.com/blog/application-state-management-with-react
  • https://kentcdodds.com/blog/state-colocation-will-make-your-react-app-faster



State Colocation

  • https://kentcdodds.com/blog/state-colocation-will-make-your-react-app-faster

  • https://kentcdodds.com/blog/colocation


State machine in js

  • 
https://github.com/tannerlinsley/react-query

  • https://kentcdodds.com/blog/implementing-a-simple-state-machine-library-in-javascript



Use memo and useCallback

  • 
https://kentcdodds.com/blog/usememo-and-usecallback



Composition vs Prop drilling

  • 
https://twitter.com/mjackson/status/1195495535483817984


Immer

  • https://immerjs.github.io/immer/docs/introduction



Codebases to learn from

reach-ui codebase is really cool to checkout, good use of patterns etc

downshift.js also pretty cool

  • https://github.com/reach/reach-ui

  • https://github.com/downshift-js/downshift

  • https://github.com/tannerlinsley/react-query
  • https://github.com/tannerlinsley/react-table



A GREAT talk on state and why redux isn't needed w/ context/reducers

  • https://www.youtube.com/watch?v=tBz3UmZG_bk


The Advanced Hooks course on github: https://github.com/kentcdodds/advanced-react-hooks So what does the course cover?

💪 01. useReducer: simple Counter

💪 02. useCallback: custom hooks

💪 03. useContext: simple Counter

💪 04. useLayoutEffect: auto-growing textarea

💪 05. useImperativeHandle: scroll to top/bottom

💪 06. useDebugValue: useMedia



more

useReducer in OT

Mattia Richetto

https://github.com/opentable/gc-monorepo-admin/blob/master/apps/gallery-photos/src/store/reducer.ts


and also for useContext:

https://github.com/opentable/gc-monorepo-admin/blob/master/apps/gallery-photos/src/common/GlobalStateProvider/GlobalStateProvider.tsx


Andrew

My tiny contribution: https://github.com/opentable/consumer-frontend/blob/master/src/app/components/CovidDataCenter/Container.js#L21-L30


Comments

Popular posts from this blog

deep dive into Material UI TextField built by mui

angular js protractor e2e cheatsheet

react-router v6.4+ loaders, actions, forms and more