uselessUseMemouseMemo is wrapping a static value. Move the value to module scope instead of paying hook overhead for no runtime benefit.small-rules/no-useless-use-memoDisallow useMemo calls that only wrap values static enough to live at module scope.
uselessUseMemouseMemo is wrapping a static value. Move the value to module scope instead of paying hook overhead for no runtime benefit.This rule accepts one options object after the severity.
import { useMemo } from "react";
const value = useMemo(() => { return 1;}, []);import { useMemo } from "react";import { AnimationLibrary, SpringConfiguration, getAnimationConfiguration } from "./animation-config";
function Component({ theme }) { const value = useMemo(() => getAnimationConfiguration(theme, AnimationLibrary.ReactSpring), [theme]); return value; }