Currently I am trying to dispatch some actions in react/redux and I am also using redux form. How do I go about implementing redux form within the react-redux connect function?
Dispatch Function:
const mapDispatchToProps = (dispatch) => {
return{
authUser: () => {
dispatch(authUser());
},
signIn: () => {
dispatch(authUser());
}
}
}
Then using the react-redux connect function:
export default reduxForm({
validate, form: 'signInForm'})
(connect(mapStateToProps, mapDispatchToProps) (SignIn))
When passing in the signIn function to the mapDispatchToProps, the form then stops submitting?
mapStateToProps function:
function mapStateToProps(state){
return {
SignInDetails: state.SignInDetails,
isAuthenticated: state.isAuthenticated
}
}
signIn Reducer:
import _ from 'lodash';
const SIGN_IN_FULFILLED = 'SIGN_IN_FULFILLED';
export default function(state, action){
//eslint-disable-next-line
switch (action.type) {
case SIGN_IN_FULFILLED:
return _.mapKeys(action.payload.data, 'id');
default:
return {};
}
}