Illustration of a microphone

Calls with Kent C. Dodds.

You call, I'll answer.

Listen to the podcasts here
Phone sitting on a stool

What's this all about?

The goal of the Call Kent Podcast is to get my answers to your questions. You record your brief question (120 seconds or less) right from your browser. Then I listen to it later and give my response, and through the magic of technology (ffmpeg), our question and answer are stitched together and published to the podcast feed.

I look forward to hearing from you!

Record your call

Calls with Kent C. Dodds Season 3 — 50 episodes

22.How close should a hook be to its usage?
03:27
Keywords

React, custom, hooks

Description
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!
22.How close should a hook be to its usage?
03:27
Keywords

React, custom, hooks

Description
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!
22.How close should a hook be to its usage?
03:27
Keywords

React, custom, hooks

Description
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!
22.How close should a hook be to its usage?
03:27
Keywords

React, custom, hooks

Description
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!

Looking for more content?

Have a look at these articles.

See the full blog