pH200 / cycle-react

Rx functional interface to Facebook's React
MIT License
370 stars 18 forks source link

Lifecycle events? #5

Closed alexmingoia closed 9 years ago

alexmingoia commented 9 years ago

I have a component which is a view. Page changes, view changes. I now need to load initial data to populate the view. How is this event modeled? Essentially, how do I get the "interaction" for a componentDidMount? Or could you explain another way I can populate data for an initial view using AJAX?

I have the same problem with Cycle... maybe I should open an issue there.

alexmingoia commented 9 years ago

I guess I use the DOM load event for this?

alexmingoia commented 9 years ago

Closing this based on cycle gitter discussion. I will just write a wrapper to turn HTML5 history changes into observables.

pH200 commented 9 years ago

The only useful lifecycle event is probably componentDidMount. But if you only want to load initial data using AJAX, you could just make an observable of that AJAX request and build the vtree$ from that observable. By the way, cycle-react subscribes your vtree$ during componentWillMount.