Add "ownProps" argument for stateToComputed/dispatchToActions
See original GitHub issueThis is something react-redux does. For us it might look like:
{{user-detail userId=567}}
const stateToComputed = (state, ownProps) => {
return {
user: getUserById(state, ownProps.userId)
}
}
I think this should be simple to add. react-redux defines this argument as
the props passed to your component
so we’re not talking about all possible properties on the Ember Component, just what was passed to it, which Ember stores in attrs
.
We can pass in attrs to the functions, and then listen to didUpdateAttrs
so connect would be something like
...
handleChange() { // and also in init
...
let props = stateToComputed(redux.getState(), this.attrs);
...
},
didUpdateAttrs() {
this.handleChange();
}
Issue Analytics
- State:
- Created 7 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
What is the use of the ownProps arg in mapStateToProps and ...
I see that the mapStateToProps and mapDispatchToProps function which are passed to the connect function in Redux take ownProps as a second argument....
Read more >Connect: Extracting Data with mapStateToProps - React Redux
It should take a first argument called state , optionally a second argument called ownProps , and return a plain object containing the...
Read more >Add state as the third parameter to mapDispatchToProps #237
So that I could do this: var ToggleFollowButton = ({toggleFollow}) => Toggle ; ToggleFollowButton = connect(null, (dispatch, ownProps, ...
Read more >Defining and Using React Redux mapStateToProps Function
The first argument, which is state , has the entire Redux store state. ... Therefore, we should only add ownProps to the parameter...
Read more >Mastering mergeProps in Redux - Peanut Butter JavaScript
it takes three arguments: ownProps – which contains all of the props passed into the component outside of the connect function; mapProps –...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Unless someone sees something wrong with this, I will spin up a PR tomorrow.
@dustinfarris ah right on 😃