Add component.destroy() method
Stops auto rending and wipes DOM clean
I'd love to see this! I was thinking about implementing something like an usubscribe method, where you'd detach from processing state changes but keep the component html on page.
I was also considering implementing a "when" utility function (similar to mobx when) which would allow a one-and-done reaction to a change on a store that matches the condition, and then stops listenting. Could also be implemented as a method on the store itself.
It would also be great to have a "reaction" utility function (again, similar to mobx here), which would allow you to react to stores without having a component. Many use cases for reactivity don't result in UI re-renders, but actually in just firing some side-effect. Is there currently a way to fire arbitrary side effects from store changes?
This is a really cool project, appreciate your work here, and I love the direction you went in v12.
@t-lock Apologies for being a year late to respond to this one. The things you're asking about are actually already supported in Reef.
- You can use
stop()andstart()methods on the component to stop reactively rendering and restart it, respectively. - For manual or one-time updates, you might consider using a
reef:storeevent listener, with theonceproperty set in theaddEventListener()options object.
The even listener will also allow you to fire side-effects without rendering