Kris Guzman
1 min readMay 28, 2019

--

That’s actually by design. Hooks are strictly meant for react components as their only purpose is to “hook” into react API. I’m a little confused by your example though. Why not pass the onclick handler as a prop? Why do you need the hook to be outside the component?

--

--

Kris Guzman
Kris Guzman

Written by Kris Guzman

Front end developer. On a mission to explore the world & build amazing software. Connect with me on LinkedIn: https://www.linkedin.com/in/kristopher-guzman/

Responses (1)