-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Need something more robust to handle React Router params #5
Comments
Worth considering: Should the the list of dispatchable things be provided by a factory? Like |
Also, |
dispatchOn is a decorator that allows the user to define many lifecycle hooks that dispatch thunkservables as part of a single higher-order component. Allowed hooks are `willMount` (componentWillMount), `mount` (componentDidMount), `update` (componentDidUpdate), and `willReceiveProps` (componentWillReceiveProps) closes #5 BREAKING CHANGE: `dispatchOnMount` is removed in favor of `dispatchOn`
Have y'all taken a look at redux-epic containers https://github.com/BerkeleyTrue/redux-epic/tree/master/docs/api#contain The idea behind: The presentational component requires a certain piece or pieces of data to be present, this can be taken care of by one action. The actually lifecycle hooks aren't important to the user, they just care that the data is there. We provide helper methods for that container that can determine when not to call the action, for instance if the data is already primed. It becomes the fetch container, redux's connect provides the data container, and the user provides the presentational component. A good question: What is the main goal of this HoC? |
ping @jayphelps |
@BerkeleyTrue we're not thrilled on the existing code in here and I personally use some other HoCs I've created that aren't here yet. We're just experimenting at this point. I'll look at redux-epic's when I get a chance. 👍 |
According to the documentation on component lifecycle with react-router, users should be making ajax requests and using route params both at
componentDidMount
andcomponentDidUpdate
. It seems like we might need a decorator (or the decorator) to handle more lifecycle hooks than justdispatchOnMount
.We can either do several decorators for each lifecycle hook we care about, which would incur the overhead of more higher-order components, or, we can have a single HoC to rule them all.
Or the one lifecycle decorator idea:
The text was updated successfully, but these errors were encountered: