-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
Hey, I like your plugin and it works great. Although I have one addition which would be useful.
Some actions like dispatch actions (from useState) are referred to as stable references. They do not change and thus are not needed as dependencies.
Although it makes no difference if you add it, technically it's just unnecessary code.
A rule to detect this would be nice, for example in the code:
const [loading, setLoading] = useState(true);
const startLoading = useCallback(() => setLoading(true), [setLoading]); // setLoading is not needed because it is a stable referenceAccording to the react documentation regarding hooks this should apply to the following 3 hooks:
- useState
- useReducer
- useId
WesleyYue
Metadata
Metadata
Assignees
Labels
No labels