Let's test our Redux containers:
- Redux containers should not have any JSX code; the best practice is to have mapStateToProps and mapDispatchToProps in our connect method passing another component (such as a Layout component) in the export, for example, let's see our Todo List Container:
// Dependencies import { connect } from 'react-redux'; import { bindActionCreators } from 'redux'; // Components import Layout from '../components/Layout'; // Actions import { fetchTodo } from '../actions'; export default connect(({ todo }) => ({ todo: todo.list }), dispatch => bindActionCreators( { fetchTodo }, dispatch ))(Layout);
File: src/client/todo/container/index.js
- You might be wondering what exactly we need to test in here. Well, ...