Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
Is it wrong to use custom hooks inside other custom hooks? #606
Well hooks make it possible for us to share logic across multiple components.
But you know... They are also functions...
Sometimes it is appealing to further break the logic that can be shared across multiple "hooks".
For a simple example; instead of using useContext inside a custom hook, i might want to useRequiredContext, which throws an error if the context is not available. Do I have to duplicate the logic of useRequiredContext to all of my custom hooks that uses it or can I just call that hook?