You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm not able to pass dispatch directly into the Field component. It appears to be stripping any prop with the name dispatch. I'm not sure if this was on purpose, but the behaviour was surprising to me and not very intuitive.
A simplified version of what doesn't work:
render(constfieldProps={dispatch,// passing dispatch into Field, along with other props
...
};return<Fieldname="phone"component={Phone}{...fieldProps}/>;)-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_exportconstPhone=props=>{console.log(props.dispatch)// undefined// ^^^^^^^^ dispatch is being stripped from props passed into <Field />return(<input{...props.input}type="tel"name="tel"/>);};
How I had to fix it:
constfieldProps={reduxDispatch: dispatch,// ^^^^^ renaming dispatch to something else so it doesn`t get stripped
...
};
The text was updated successfully, but these errors were encountered:
brotzky
changed the title
[6.0.0-rc.5] Unexpected behaviour when passing props to <Field />
[6.0.0-rc.5] Unexpected behaviour when passing dispatch as prop to <Field />
Aug 18, 2016
I'm not able to pass dispatch directly into the
Field
component. It appears to be stripping any prop with the namedispatch
. I'm not sure if this was on purpose, but the behaviour was surprising to me and not very intuitive.A simplified version of what doesn't work:
How I had to fix it:
The text was updated successfully, but these errors were encountered: