The Call Kent Podcast

How close should a hook be to its usage?


Listen Later

Transcript: Key Kent! Big fan since I started learning React many moons ago! My name is Asier and I hope you're having a good day. My question is about React custom hooks and your opinion on the following. Imagine there is one parent component in charge of rendering two children components. This parent component is using a custom hook to retrieve some relevant data, let's say that it receives the user name and the date of birth for instance. The first child component requires a prop for the user name and another for the date of birth; and the second child requires another prop but only for the date of birth. My assumption was always to use the hook as close as possible to its usage, in this case, within both children components and not in the parent component. What should be the more readable choice between using the hook just once in the parent component and drilling the props downwards to the children, as opposed to using the hook in each individual hook?

Thanks!

How close should a hook be to its usage?

...more
View all episodesView all episodes
Download on the App Store

The Call Kent PodcastBy Kent C. Dodds

  • 5
  • 5
  • 5
  • 5
  • 5

5

2 ratings


More shows like The Call Kent Podcast

View all
The Changelog: Software Development, Open Source by Changelog Media

The Changelog: Software Development, Open Source

285 Listeners

Software Engineering Daily by Software Engineering Daily

Software Engineering Daily

629 Listeners

Soft Skills Engineering by Jamison Dance and Dave Smith

Soft Skills Engineering

275 Listeners

The Daily by The New York Times

The Daily

111,160 Listeners

Syntax - Tasty Web Development Treats by Wes Bos & Scott Tolinski - Full Stack JavaScript Web Developers

Syntax - Tasty Web Development Treats

989 Listeners

PodRocket - A web development podcast from LogRocket by LogRocket

PodRocket - A web development podcast from LogRocket

58 Listeners

devtools.fm: Developer Tools, Open Source, Software Development by Andrew Lisowski, Justin Bennett

devtools.fm: Developer Tools, Open Source, Software Development

27 Listeners

Mostly Technical by Ian Landsman and Aaron Francis

Mostly Technical

15 Listeners