Skip to content

Weichwarenprojekt/react-async-effect

Repository files navigation

react-async-effect

react-async-effect is a custom React hook that helps you handle side effects in a React component, with improvements for async effects.

Quickstart

  • Install the package using the following command:
    npm install --save @weichwarenprojekt/react-async-effect
  • Import the useAsyncEffect hook in your component file:
    import { useAsyncEffect } from '@weichwarenprojekt/react-async-effect';
  • Use the hook in your component, e.g. for fetching data from an api:
    useAsyncEffect(async () => {
        const response = await fetch('https://api.example.com/data');
    
        const data = await response.json();
        // Do something with data
    }, []);

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published