Echo JS 0.11.0


tracker1 1022 days ago. link 2 points
This kind of flies in the face of the trend to separate stores/state from the components in favor of simpler components...  Also, there's no cleanup of the event registrations which will lead to memory leaks.
badsyntax 1020 days ago. link 1 point
Also they're using DOM api instead of using the more react standard "ref" attribute
ndks 1022 days ago. link 1 point
Perhaps you're right - but the trend doesn't necessarily account for all use cases.

Assuming the OP is only modifying the components internal state (which has no bearing on the application state), I'd be all for it.
ndks 1023 days ago. link 2 points
Hey, thanks for the share. Where I haven't used Rx per se, I used Bacon extensively at my last gig.

Rx is a module, and you're merging `plus$` and `minus$` to 'Rx.Observable' - is there an issue of having these bindings persist when the React component unmounts? What would be the best practice for tidying up in `componentWillUnmount`?
gschambers 1022 days ago. link 2 points
Calling `subscribe` on an observable returns a subscription that can be disposed at a later time. The approach that I use is something like this:

If you are subscribing to multiple observables in a single component, you could also consider using `CompositeDisposable`, which allows you to merge multiple subscriptions into a single disposable.
ndks 1022 days ago. link 1 point
Cool, thanks for the clarification.

I guess I should read a bit of the Rx API docs, but doesn't seem far off Bacon with `combineTemplate`; which from memory returns a curried function to end any streams. Someone correct me if I'm wrong.
zarr2k 1022 days ago. link 1 point
There very much is - without having dug deeper, this doesn't look like a complete answer, but merely serves as an introduction on how to begin using it.

You should definately unregister your event listeners in componentWillUnmount. If you wanted to pursue this approach I would probably make a higher level component (or mixin) to declaretively and automatically handle the binding and unbinding of events, plus the glue to rxObservables.
goblinking 1020 days ago. link -1 point
RxJS provides this consideration with dispose() for many ephemeral Observables.  Keep track of your subscriptions and dispose in `componentWillUnmount`.

e: better data above.