The reason I like this way of creating hooks is, it is easier & cleaner to provide executable functions to components. Any suggestions or tips?
I know the title says Complex Custom Hooks but this example is very simple so everyone can follow.
I use this way of creating Custom Hooks also for complex Mutations with React Apollo, so all the mutation logic is inside my hook and the component has only markup all it gets are the functions from the custom hook.
The difference to normal hooks is you need to wrap your -
component who needs the data with the Context.Provider to use the hook.