use-immer icon indicating copy to clipboard operation
use-immer copied to clipboard

React Compiler Bug

Open dylancetin opened this issue 7 months ago • 1 comments

Hi,

Following line, i believe is an invalid hook call. The problem was that useCallback was being returned directly without being defined as a constant first. When i copied the index.ts file into my project and changed the code to define useCallback as a const before returning it, the error was resolved.

https://github.com/immerjs/use-immer/blob/master/src/index.ts#L19-L22

dylancetin avatar May 05 '25 07:05 dylancetin

It is very invalid. hook calls must only we written at the root of a function and not be nested in any way.

yairEO avatar Oct 09 '25 08:10 yairEO