no-unused-use-memo
errorProblem
Reports useMemo calls whose return value is ignored.
Rule details Problem
Section titled “Rule details Problem ”This rule reports useMemo(...) when it is used as a standalone statement, including void useMemo(...). If you are
running side effects, use useEffect. If you need memoization, keep and use the returned value.
By default, the rule looks for React imports in the roblox-ts environment. Set environment to "standard" to use
react instead.
Options
Section titled “Options”| Option | Type | Default | What it does |
| ———–– | ———— | ———– | ———–– | –––––––––––––––––––––– |
| environment | "roblox-ts" | "standard" | "roblox-ts" | Chooses which React package imports to track |
Examples
Section titled “Examples”Incorrect
import { useMemo } from "react";
useMemo(() => { trackAnalytics();}, [eventName]);
void useMemo(() => buildConfig(eventName), [eventName]);Correct
import { useEffect, useMemo } from "react";
useEffect(() => { trackAnalytics();}, [eventName]);
const config = useMemo(() => buildConfig(eventName), [eventName]);Related rules
Section titled “Related rules”require-named-effect-functionsRequires named effect callbacks
no-useless-use-memoMoves static memo values to module scope
use-exhaustive-dependenciesChecks hook dependency lists
React Docs: useMemoOfficial reference for useMemo
