---
url: /docs/guide/usage/linter/rules/react/void-use-memo.md
---

### What it does

Validates that `useMemo()` callbacks return a value and that the
memoized result is actually used by the component or hook.

Powered by the React Compiler, which runs once per file and is shared
with the other React Compiler rules. Port of
`react-hooks/void-use-memo`.

### Why is this bad?

A `useMemo` callback that returns nothing, or whose result is never
used, is not memoizing anything — it is usually a side effect in
disguise, which belongs in an event handler or effect instead.

### Examples

Examples of **incorrect** code for this rule:

```jsx
import { useMemo } from "react";
function Component({ a }) {
  useMemo(() => {
    console.log(a); // returns nothing, result unused
  }, [a]);
  return <div>{a}</div>;
}
```

Examples of **correct** code for this rule:

```jsx
import { useMemo } from "react";
function Component({ a }) {
  const x = useMemo(() => a + 1, [a]);
  return <div>{x}</div>;
}
```

## How to use

## Version

This rule was added in v1.79.0.

## References
