Comments (4)
Same issue here.
Any idea ?
thanks for your help
from peckish.
@Benouzef did you use the connect()
method from react-redux
? Can you provide sample code or a branch?
from peckish.
Hi @jlebensold,
Thanks for your feedback : I seem to be "messing around" with redux configuration. I have "copied" your app to play around with it and I have a nested component "below" app which is the container (your Home component basically).
I can't get a reference to 'this.props.addRecipe()' if I don't add : connect as well as mapDispatchToProps in the nested component.
I thought I had to pass mapDispatchToProps in the connect call only in the appContainer file.
Am I misunderstanding something or do you have to repeat the "export default connect(mapStateToProps, mapDispatchToProps)(Home)" in each component ?
I thought I could only do "connect(mapStateToProps)(Home)"
Thanks for your advice
from peckish.
Hi @Benouzef ,
There's no "magic" (e.g. IoC containers or DI) with Redux. when you call connect
, you are basically wrapping your Home
React component in a wrapper component that connects your React component to the Redux store. This is how the props become accessible to your component. In principle, you want to delineate which components are "smart" components that some understanding of global state and which components are "dumb" and just receive props and do whatever they need to do.
from peckish.
Related Issues (12)
- Network request failed
- Two separate routes on one page HOT 1
- Could not find "store" in either the context or props of "Connect(AppContainer)". HOT 1
- Element type is invalid HOT 1
- Element type is invalid (When adding ApplicationTabs) HOT 1
- react-navigation / redux tutorial HOT 1
- Object is not a function(evaluating '(0,_createReducer2.default))')
- Element type is invalid HOT 2
- NavigationExperimental has been removed HOT 8
- A valid React element (or null) must be returned. HOT 3
- Unrecognised token '<' error HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from peckish.