useOnce
Hook that runs an effect only once. Please do not use it in production code!
humor
low
test coverage
Last changed: 7 months ago
WARNING
This hook will run effect only once even in strict mode. Please do not use it in production code!
Installation
Library
CLI
Manual
typescript
import { useOnce } from '@siberiacancode/reactuse';Usage
typescript
useOnce(() => console.log('effect once'));Demo
Api
Parameters
| Name | Type | Default | Note |
|---|---|---|---|
| effect | EffectCallback | - | The effect to run |
Type declaration
typescript
import type { EffectCallback } from 'react';Source
Source • DemoContributors
D