DEV Community

Discussion on: Building a Reactive Library from Scratch

Collapse
 
ryansolid profile image
Ryan Carniato

In the code above effect's dependencies are being added but not really used anywhere except for cleaning itself

  1. That is why. Each Effect needs to unsubscribe itself on cleanup/re-run. We need to know since the Signal holds the subscriptions. A long lived Signal could fire an Effect indefinitely otherwise long after it should be disposed.
  2. Solid has proxies but the prefered pattern is createStore which creates a readonly proxy and setter function combo. There is a createMutable like MobX/Vue available though.