-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
According to the documentation on component lifecycle with react-router, users should be making ajax requests and using route params both at componentDidMount and componentDidUpdate. It seems like we might need a decorator (or the decorator) to handle more lifecycle hooks than just dispatchOnMount.
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.
@connect(stuff, stuff)
@dispatchOnMount(stuff)
@dispatchOnUpdate(stuff)
class MyComponent extends React.Component {
// stuff
}
// or something like
const MyComponent = compose(
connect(stuff, stuff),
dispatchOnMount(stuff),
dispatchOnUpdate(stuff)
)((props) => (<div>weee</div>));Or the one lifecycle decorator idea:
@connect(stuff, stuff)
@dispatch({
onMount: [stuff, stuff],
onUpdate: [stuff]
})
class MyComponent extends React.Component {
// stuff
}
// or something like
const MyComponent = compose(
connect(stuff, stuff),
dispatch({
onMount: [stuff, stuff],
onUpdate: [stuff]
})
)((props) => (<div>weee</div>));Metadata
Metadata
Assignees
Labels
No labels