Skip to content

Missing info on reset #6

@MartinMalinda

Description

@MartinMalinda

I'm looking into the docs and I don't see any info on what's the recommended way to clean up, when using useAsync or useAsyncCallback.

Currently I'm using my own hooks that are simple wraps over useEffect and useState.

  useEffect(() => {
    const ref = fireGet(path, data => {
      cb(data);
    });

    return () => {
      ref.off();
    };
  }, effectParams || [path]);

And I'm refactoring this to react-async-hook and I'm wondering where to put that function that turns off the WebSocket connection.

Looking into the code, there's an option to provide a reset callback. Is that what I need?

Thanks for any info and thanks for creating this lib!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions