Created
May 23, 2017 15:44
-
-
Save Louiefigz/24ef376aaab3201d4e358fab37bb741e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component } from 'react'; | |
import { connect } from 'react-redux'; | |
class Tasks extends Component { | |
render() { | |
const tasks = this.props.tasks.map((task, index) => <li key={index}>{task}</li>) | |
return ( | |
<div> | |
<ul> | |
{tasks} | |
</ul> | |
</div> | |
) | |
} | |
} | |
const mapStateToProps = (state) => { | |
return { | |
tasks: state.tasks | |
}; | |
}; | |
// We're going to change the way that we export this file. | |
// export const AllTasks = connect(mapStateToProps)(Tasks); | |
// Now go back to App.js and change the import name AllTasks to Tasks | |
export default connect(mapStateToProps)(Tasks); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment