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

React 18 Strict Mode

Open melloware opened this issue 3 years ago • 9 comments

@betula have you tested with React 18 yet? One of my devs is reporting its not working to update values in React 18.

I haven't drilled into it yet but wanted to see if you have tested on 18?

melloware avatar Apr 26 '22 18:04 melloware

Here is a code sandbox reproducer showing you the updates aren't happening

React 18 Fails: https://codesandbox.io/s/todos-use-bettwen-forked-z05bcw?file=/src/index.js

React 17 Works: https://codesandbox.io/s/todos-use-bettwen-forked-7wyvuo?file=/src/index.js

melloware avatar Apr 26 '22 18:04 melloware

OK I updated to React 18.1.0 and removed <StrictMode> and it works.

https://codesandbox.io/s/todos-use-bettwen-forked-5r2ycf?file=/src/index.js

melloware avatar Apr 27 '22 19:04 melloware

I have run into the same problem. With Strict Mode enabled in React 18, there is no respective useEffect triggered.

MoonLiightz avatar May 02 '22 18:05 MoonLiightz

For now I have had to disable StrictMode to make my app work. I think its something to do with the new Strict Mode does a mount...unmount... mount with previous to make sure all components can handle future React Concurrent or something like that. Hopefully @betula can figure it out!

melloware avatar May 02 '22 18:05 melloware

Hello @melloware,

I looked, I understood. The reason for the behavior is the double call of functional components in Strict Mode. Thank you very much for such a great problem finding!

I'll fix it in the next couple of weeks. Will be soon.

Thank you all for your activity on the project!

betula avatar May 03 '22 13:05 betula

You rock!

melloware avatar May 03 '22 14:05 melloware

Hello Guys! @melloware, and @MoonLiightz

Great news! I made some changes and now Strict Mode works.

https://codesandbox.io/s/todos-use-bettwen-forked-fonshg?file=/src/index.js

Feel free to try and give your feedback!

Release 1.3.4

Enjoy and Happy Coding)

betula avatar May 08 '22 08:05 betula

@betula that is great news! We will update and let you know how it goes.

melloware avatar May 08 '22 11:05 melloware

Team has verified this is working. Once again thanks for your great work!

melloware avatar May 09 '22 13:05 melloware