do-not-use-effect
v1.0.0
Published
useEffect, but it judges you for it
Readme
do-not-use-effect
A useEffect wrapper that gently questions your life choices.
Installation
npm install do-not-use-effectReact is a peer dependency — your project's React is used.
Usage
import { doNotUseEffect } from "do-not-use-effect";
doNotUseEffect(() => {
document.title = "I regret this";
}, []);Every call prints a warning to the console:
⚠️ doNotUseEffect(): You are using useEffect! Are you sure?
If you are, no judgment. We're all just out here doing our best.Then it runs your effect anyway, because who are we to stop you.
API
doNotUseEffect(callback: EffectCallback, deps?: DependencyList): voidIdentical to useEffect. Accepts the same arguments, follows the same rules, carries significantly more guilt.
Why
Because sometimes you need useEffect, and sometimes you need to be reminded that you need useEffect.
License
MIT
