Search code examples
reactjspreactreact-18preact-signal

Does @preact/signals-react work with concurrent mode of React 18?


React 18 enables concurrent mode by default -- at least in the Creact React App generated starter index.js.

However, tired with the complexity that comes with a hooks based application design, and the care I must exercise in avoiding costly re-renders of component subtrees and manually tracking dependency lists in hooks, I want to switch to Signals from @preact/signals-react.

Is it safe to use signals from this package in React 18 concurrent mode?


Solution

  • Full disclosure: I'm a maintainer.

    They do work with React 18 and all known React features at the moment, though the React team has publicly stated on Twitter they're planning some features in the future that will break our current implementation. When/if these features land, we can take a look, but for now, everything seems to be working correctly.

    Whether that's "safe" enough is very subjective and up to the end user to decide, of course.