Next.js Discord

Discord Forum

Is there a way to experimental React feature useEffectEvent in NextJS?

Unanswered
Cape lion posted this in #help-forum
Open in Discord
Cape lionOP
Hi,

I have a similar use case as documented at https://react.dev/reference/react/useEffect#reading-the-latest-props-and-state-from-an-effect where I would like to use useEffectEvent in my component.

However, import { experimental_useEffectEvent } from "react"; gives me a an error TypeError: (0 , react__WEBPACK_IMPORTED_MODULE_1__.experimental_useEffectEvent) is not a function. Is there a way to use this feature?

I see that there were similar question in this forum before, e.g: https://discord.com/channels/752553802359505017/1221446318032031764.

Alternatively, does anyone know any alternative way to achieve similar functionality as useEffectEvent for the example in the link that I pasted above?

0 Replies