React library that supports JavaScript Signals standard proposal
Thanks for the great proposal. I'm willing to try to apply signals into next React project I'm going to work on, and the most common library for that has very custom API and I would prefer to stick to a "standard" library for signals even if this proposal has only stage 1. Does anybody knows if there is a React library that supports this proposal?
to stick to a "standard" library for signals
What would that look like? React has no ergonomic/automatic way of retaining referential integrity, afaik
The other way I've seen Signals<->React integration work is via:
- https://github.com/dai-shi/use-signals
@NullVoxPopuli that's correct. I was thinking of something that behaves similarly to effect and re-renders component when signal is triggered.
<div>{signal.get()}</div>
@preact/signals-react at this case requires to call useSignals() at the beginning of every component, and it can be avoided with a Babel plugin. Unfortunately, I couldn't yet figure out how to implement a hook like that and the only idea I have is to make a wrapper, but that is almost an anti-pattern today.
@jkup any comment about the issue completion?
@finom Sorry! I've just been going through older issues. Reopening now! What do you think would be the best outcome for this? I was thinking we could:
- Explain why adding Signals support to react is difficult on the README
- Add links to the README for current React+Signals libraries like https://github.com/dai-shi/use-signals or https://signia.tldraw.dev/?
- Bring up React integration at one of our community calls to see if anyone has ideas on how we could better support integration?
@jkup I think the best outcome would be either a library, or an article on how to build such library if it's small. But as far as I understand from your comment it's not really doable, is that correct? If there is going to be a widely used library that allows to utilize the "standard signals" in practice, the standard itself is going to be pushed forward significantly IMO.