betula/use-between

React 18 Strict Mode

melloware opened this issue ยท 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?

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

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

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

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!

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!

You rock!

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 that is great news! We will update and let you know how it goes.

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