preactjs / signals

Manage state with style in every framework
https://preactjs.com/blog/introducing-signals/
MIT License
3.63k stars 88 forks source link

@preact/signals-react value changing didn't call rerender components #500

Closed winkyBrain closed 5 months ago

winkyBrain commented 5 months ago

It's working fine on 1.3.6 version, but after update to version 2.0.0 expected behavior is broken. Example

betula commented 5 months ago

It’s will work only with Preact, but for React you should use Babel plugin or function “useSignals()” for make a component reactive.

import { useSignals } from "@preact/signals-react/runtime";

const count = signal(0);

function CounterValue() {
    useSignals();
    return <p>Value: {count.value}</p>;
}
rschristian commented 5 months ago

Please don't upgrade majors without reading the docs to see what's changed.

https://github.com/preactjs/signals/tree/main/packages/react#react-integration