Skip to content

useOnce ​

humor
test coverage
Last changed: 10 days ago

WARNING

This hook will run effect only once even in strict mode. Please do not use it in production code!

Hook that runs an effect only once. Please do not use it in production code!

typescript
import { useOnce } from '@siberiacancode/reactuse';

Usage ​

typescript
useOnce(() => console.log('effect once'));

Demo ​

Api ​

Parameters

NameTypeDefaultNote
effectEffectCallback-The effect to run

Source ​

Source • Demo

Contributors ​

Avatardebabin

Released under the MIT License.