Eugene Podoliako Eugene Podoliako - 1 year ago 115
React JSX Question

React-redux doesn't set mapDispatchToProps into props

Can you help to undestand why my container doesn't transfer dispatch prop

into component?

My container:

import { connect } from 'react-redux'
import AddCarWashForm from './../components/carwash/subComponents/AddCarWashForm.jsx'
import {addInfo} from './../actions'

const mapDispatchToProps = (dispatch) => {
return {
saveInfo: (info) => {

const AddCarWashFormContainer = connect(

export default AddCarWashFormContainer

Here is part of AddCarWashForm.jsx

export default class AddCarWashForm extends React.Component{

static contextTypes = {
saveInfo: React.PropTypes.func.isRequired

And when I execute this code, I see in console:
Warning: Failed context type: Required context 'saveInfo' was not specified in 'AddCarWashForm'.

Answer Source

You're mapping to props, not to context. Define it as a propType instead and it'll work as you expect it.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download