{"repo":"rauldeheer/use-async-effect","free":true,"listed":false,"github":"https://github.com/rauldeheer/use-async-effect","clone":"git clone https://github.com/rauldeheer/use-async-effect.git","description":":running: Asynchronous side effects, without the nonsense","language":"JavaScript","stars":317,"topics":["react","reactjs","hooks","async-await","useeffect","react-native","await","async","use-async-effect"],"license":"MIT","category":"mobile-apps","readme_excerpt":"--- :running: Asynchronous side effects, without the nonsense. Installation or This package ships with TypeScript and Flow types. API The API is the same as React's useEffect() , except for some notable differences: - The destroy function is passed as an optional second argument: - The async callback will receive a single function to check whether the callback is still mounted: Mounted means that it's running in the current component. It becomes unmounted if the component unmounts, or if the component is re-rendered and the callback is dropped and a new one is called. Examples Basic mount/unmount Omitting destroy Handle effect result in destroy Making sure it's still mounted before updating component state Linting dependencies list using ESLint The react-hooks/exhaustive-deps rule allows you to check your custom hooks. From the Advanced Configuration options: exhaustive-deps can be configured to validate dependencies of custom Hooks with the additionalHooks option. This option accepts a regex to match the names of custom Hooks that have dependencies. ‼️ Unfortunately, react-hooks/rules-of-hooks isn't configurable and the \"Effect callbacks are synchronous to prevent race conditions. Put the async function inside\" warning will be displayed.","default_branch":null,"files":null,"tree":[],"storefront":"/r/rauldeheer","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/rauldeheer/use-async-effect/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}