Allow connect in more than one component connect(props, dispatchs)([Comp1, Comp2])
See original GitHub issueHi RR team.
I’m thinking about create the possibility to connect the redux store in more than one component.
Today, we have the following way to connect into one component:
const myContainer = connect(props, dispatchs)(ComponentIWantToConnect)
And I’m willing to do this to share the same store:
const myContainer = connect(props, dispatchs)([ComponentIWantToConnect, AnotherComponent])
What do you think about it?
Issue Analytics
- State:
- Created 7 years ago
- Reactions:2
- Comments:7 (7 by maintainers)
Top Results From Across the Web
Connect
The connect() function connects a React component to a Redux store. It provides its connected component with the pieces of the data it...
Read more >Can I pass multiple components within connect redux
You can only pass one Component to connect. So, instead, you'd have to do two connects:
Read more >React Redux connect(): When and how to use it
Cover when and how to use the React Redux connect() API to create container components that are connected to the Redux state.
Read more >How to connect redux to a none default component-Reactjs
You can connect multiple components within the same file, with or without ... export default connect(mapStateToProps, mapDispatchToProps)(WrapperComponent);.
Read more >React Redux
Any component in your application can be wrapped with connect and "connected" to the store. Connecting more components is usually better for performance....
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
Okay. So, because
connect
returns a function, you can do this:You can re-use the function that is created by
connect
, rather than only calling it immediately.Or, I guess you could even do:
I don’t understand what you’re trying to accomplish.