Skip to content
public-library›Rules›React›Name Effect and non-trivial Hook callbacks

Name Effect and non-trivial Hook callbacks

Pass a named function expression to every useEffect call, and to other Hooks such as useMemo and useCallback when the callback does non-trivial work. Name it for the job it does, starting with a verb. When the logic grows its own state or cleanup, move it into a custom Hook named for that behavior.

In the full rule