react-hooks icon indicating copy to clipboard operation
react-hooks copied to clipboard

Why does useFilesystem Exists?

Open hheimerd opened this issue 1 year ago • 2 comments

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

hheimerd avatar Jun 05 '23 20:06 hheimerd

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,
    };
}

hheimerd avatar Jun 05 '23 20:06 hheimerd

This is rude and should be closed.

oliveryasuna avatar Nov 05 '23 00:11 oliveryasuna