Okay, so I’m using the BrowserRouter
component in my index.js
as the Router that wraps my App component, which everything else is inside of.
I attempted using my redirect in my handleSubmit
for my form component.
I received error, this.props.history is undefined
.
handleSubmit(event) {
event.preventDefault();
// this.setState({ alert_message: 'success' });
const momentObj = {
minutes: this.state.minutes,
date: this.state.date,
time: this.state.time,
location: this.state.location,
mental: this.state.mental,
environmental: this.state.environmental
};
this.props.dispatch(newMoment(this.props.authToken, momentObj));
this.props.history.push('/dashboard');
}