'dispatch' is not a function when argument to mapToDispatchToProps() in Redux 'dispatch' is not a function when argument to mapToDispatchToProps() in Redux javascript javascript

'dispatch' is not a function when argument to mapToDispatchToProps() in Redux


If you want to use mapDispatchToProps without a mapStateToProps just use null for the first argument.

export default connect(null, mapDispatchToProps)(Start)


You are just missing the first argument to connect, which is the mapStateToProps method. Excerpt from the Redux todo app:

const mapStateToProps = (state) => {  return {    todos: getVisibleTodos(state.todos, state.visibilityFilter)  }}const mapDispatchToProps = (dispatch) => {  return {    onTodoClick: (id) => {      dispatch(toggleTodo(id))    }  }}const VisibleTodoList = connect(  mapStateToProps,  mapDispatchToProps)(TodoList)


Use

const StartContainer = connect(null, mapDispatchToProps)(Start) 

instead of

const StartContainer = connect(mapDispatchToProps)(Start)