-
Notifications
You must be signed in to change notification settings - Fork 1.3k
request: Add HOC to support "get async data on mount" pattern. #54
Comments
Thanks for the suggestion! I'm not sure to what extent Recompose should be providing lifecycle hooks. I'd like to think about this for a while before making any decisions. |
Hmmm. Well, one option would be to have a separate package
|
Lifecycle events are cool but I think there is no reason for packages like
|
@RafalFilipek This breaks in universal app situations (server-side kick-off alongside client-side run-time). The missing aspect here is that a lifecycle method such as |
Btw, I'm currently using the following home-grown import { Component } from 'react';
import createHelper from 'recompose/createHelper';
import createElement from 'recompose/createElement';
export const doOnMount = createHelper(callback => BaseComponent =>
class extends Component {
componentDidMount() {
callback(this.props);
}
render() {
return createElement(BaseComponent, this.props);
}
}
, 'doOnMount'); Let's find out how it suits my purpose… |
I am agree with @timmolendijk. |
However, it seems like there is still no consensus whether |
Closing because we now have two ways to do this: rx-recompose's |
I have this pattern all over my codebase:
A component, such as ComponentA, has to make an ajax call on mount, and then pass that data to another component on completion. I'm imagining a HOC signature that looks something like this:
The text was updated successfully, but these errors were encountered: