react-hooks
react-hooks copied to clipboard
Why does useFilesystem Exists?
Why do I need this hook? Why are you not satisfied with accessing these functions directly? All functions from this hook are static and have no initialization stage, functions have no state, available features do not change. These are literally static functions wrapped in useCallback, which are already memoized and never change.
And this is the only hook that is described in the documentation
I have come up with a new hook for you, you can use. If necessary, I can make a pull request.
type RoundOptions = number
type MathResult = {
random(): number,
round(options: RoundOptions): number,
isAvailable: boolean
}
export function useMath(): MathResult {
const random = useCallback(() => {
const result = Math.random();
return result;
}, []);
const round = useCallback((options: RoundOptions) => {
const result = Math.round(options);
return result;
}, []);
return {
random,
round,
isAvailable: true,
};
}
This is rude and should be closed.