preactjs / signals

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

signals-react 1.2 break all the reactive feature in 1.1 #316

Closed jarvisaoieong closed 1 year ago

jarvisaoieong commented 1 year ago
export default function Test() {
  const count = useSignal(0)
  const double = useComputed(() => count.value * 2)
  const text = useSignal('')

  return (
    <div>
      <button onClick={() => (count.value += 1)}>
        Value: {count.value}, value x 2 = {double}
      </button>
      <input value={text} onChange={(e) => (text.value = e.target.value)} />
    </div>
  )
}

The code above work fine in version 1.1.1 But after version 1.2.0, it failed.