Can I create a hook like this?
izengliang opened this issue · comments
Zeng Liang commented
I want this , don't link extends Hook class
. Can i?
export function useAddHook(num){
const [state, setState] = useState(0)
useEffect(()=>{
setState(state + num);
},[num]);
return state;
}
Anthony Hinsinger commented
Sure you can ... combining hooks is the best way to create new hooks.
Anthony.
Matthew Phillips commented
Yep, the Hook class is only for low levels hooks.