react custom Hook throwing errors ! #16761
-
Bug reportDescribe the bugGetting this error when calling a custom hook : To ReproduceSteps to reproduce the behavior, please provide code snippets or a repository: Added screen shots how I got the issue. Expected behaviorIts a simple custom hook and it should work. ScreenshotsIf applicable, add screenshots to help explain your problem. System information
Additional contextAdd any other context about the problem here. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
should be
since that hook returns as object: function useLoadCartData(val = false) {
...
return { loadCartData };
} |
Beta Was this translation helpful? Give feedback.
const [loadCartData] = useLoadCartData(false);
should be
const {loadCartData} = useLoadCartData(false);
since that hook returns as object: