Skip to main content
GoodFirstPicks
DashboardIssuesReposLeaderboard

GoodFirstPicks by Leaveitblank © 2026

CreatorRequest a RepoPrivacy PolicyTerms of Service
Bug: `useEffectEvent` retain the first render value when is used inside a component wrapped in `memo()` | GoodFirstPicks

Bug: `useEffectEvent` retain the first render value when is used inside a component wrapped in `memo()`

facebook/react 5 comments 1mo ago
View on GitHub
lowopenScope: clearSkill match: maybeTest focusedReactJavaScriptTypeScript

Why this is a good first issue

Bug appears fixed in latest Canary version.

AI Summary

The issue describes a bug where `useEffectEvent` retains the first render value when used inside a `memo`-wrapped component. The maintainer suggests this was fixed in a recent PR and confirms the fix in the latest Canary release. No further action is needed unless the issue persists in the stable release.

Issue Description

useEffectEvent retains the first render value when it's used inside a component wrapped in memo()

React version: 19.2.0

Steps To Reproduce

Minimal repro:

import { useState, useEffectEvent, useEffect, memo } from "react";

function App() {
  const [counter, setCounter] = useState(0);

  const hello = useEffectEvent(() => {
    console.log(counter);
  });

  useEffect(() => {
    const id = setInterval(() => {
      hello();
    }, 1000);
    return () => clearInterval(id);
  }, []);

  return (
    <div>
      <button onClick={() => setCounter(counter + 1)}>{counter}</button>
    </div>
  );
}

export default memo(App);

Link to code example: https://codesandbox.io/p/sandbox/gj356q

The current behavior

If you click the button and increment the counter you always see 0 in the log. By removing the memo you will see the current counter value.

The expected behavior

See the latest counter value even if the component is wrapped in memo, since the documentation https://react.dev/reference/react/useEffectEvent does not describe any different behavior if component is wrapped in memo.

GitHub Labels

Status: Unconfirmed

Want to work on this?

Claim this issue to let others know you're working on it. You'll earn 10 points when you complete it!

Risk Flags

  • requires latest Canary version
Loading labels...

Details

Points10 pts
Difficultylow
Scopeclear
Skill Matchmaybe
Test Focusedyes