Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why does useFilesystem Exists? #53

Open
hheimerd opened this issue Jun 5, 2023 · 2 comments
Open

Why does useFilesystem Exists? #53

hheimerd opened this issue Jun 5, 2023 · 2 comments

Comments

@hheimerd
Copy link

hheimerd commented Jun 5, 2023

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
Copy link
Author

hheimerd commented Jun 5, 2023

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 hheimerd changed the title Why useFilesystem Exists? Why does useFilesystem Exists? Jun 5, 2023
@oliveryasuna
Copy link

This is rude and should be closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants