How to do it...

Let's test our Redux containers:

  1. 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
  1. You might be wondering what exactly we need to test in here. Well, ...

Get React Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.