0.1.0 • Published 10 months ago

@weichwarenprojekt/react-async-effect v0.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

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
    }, []);
0.1.0

10 months ago

0.0.1

10 months ago