DEV Community

Discussion on: New to react. Any suggestions for code management and maintainability?

Collapse
 
jwhenry3 profile image
Justin Henry • Edited

I suggest investing in learning about custom hooks, which is something you are describing.

Basically exporting a function that executes another hook:

export const useSpecificCallback = (arg1, arg2) => {
    return useCallback(() => {
         executeSomething(arg1);
        console.log("Outputting arg 2", arg2);
    }, [arg1, arg2]);
}
Enter fullscreen mode Exit fullscreen mode

This is a start to separating hooks into more re-usable chunks.