-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Proposal/Question for mapStateToProps mapDispatchToProps #985
Comments
So, ultimately You might want to read through my workshop slides on integrating a UI with Redux, and using React-Redux. Note that per the development roadmap in #950 , we are open to suggestions for new API approaches for a future v7.0 release. |
Thanks for the info. I'll definitely take a look at those slides. I know |
Is it possible? Sure - as a friend of mine says, "you can do anything - it's just software". But, that's already all the stuff that You might want to go back and read some of the discussions in issue #1 to understand the intent behind this API design. |
I'm relatively new to React and VERY new to Redux/react-redux, so this could just be the result of my lack of experience, but I find the react-redux API to be exceedingly clunky, particularly as regards the
mapStateToProps
,mapDispatchToProps
, andconnect
portion.This part of the API seems to reinvent the wheel. React already has a mechanism for mapping stuff to props: a parent component.
Imagine instead that
connect()
took one and only one argument: a component that would have access to the state object and the dispatch function. The relevant portions of the state, and the dispatching behavior, would be passed like normal props in JSX to the presentational component that actually needs them.You could even replace the connect function with a component, to make it even more consistent with the React way of thinking. I know HOCs are a React pattern, but I think you could achieve the same thing declaratively.
In short, react-redux seems to be inexplicably mixing paradigms between declarative with functional syntax, which is quite confusing.
As I said, I'm new to all of this, so maybe I've left out some important consideration.
The text was updated successfully, but these errors were encountered: