Open heron2014 opened 8 years ago
First question is : Is the next component is going to be container?
If is going to be container, this is the the flow:
import {connect } from 'react-redux' class WeatherList extends Component { render() { return ( <table className="table table-hover"> <thead> <tr> <th>City</th> <th>Temperature</th> <th>Pressure</th> <th>Humidity</th> </tr> </thead> <tbody> </tbody> </table> ); } } function mapStateToProps(state) { return {weather: state.weather} // this weather comes from reducer } //es6 syntax function mapStateToProps({ weather }) { return {weather}; } //connect our data with the current component export default connect(mapStateToProps)(WeatherList)
so now you can access weather in the inside component - this.props.weather
First question is : Is the next component is going to be container?
If is going to be container, this is the the flow:
so now you can access weather in the inside component - this.props.weather