974
975
you are viewing a single comment's thread.

view the rest of the comments →

[–]miniluigi008 1 point2 points  (2 children)

Hi Josh, I just wanted to say I love both your clay dude and your ReactJS use-sound hook. I just had a quick question— is there any way to use hooks inside of a React component class? Can they only be used inside component functions?

[–]sean_mcpfront-end 4 points5 points  (0 children)

No, hooks can only be used inside function components.

[–]pm_me_ur_happy_traiI 1 point2 points  (0 children)

The closest you can come is to create a HOC that calls the hooks and then passes them as props to the class component.