I am trying to add redirect functionality to my app when a form has been submitted, but when I try it I get the error cannot read property props of undefined
my submit function is as follows
  const handleSubmit = e => {
    e.preventDefault();
const authtoken = getCookie('token');
    if (name && email && tel && dob) {
        setFormData({ ...formData, textChange: 'Submitting' });
        axios
      .post(`${process.env.REACT_APP_API_URL}/user/new`,
        {
                name,
                email,
                tel,
                dob
        },
        {
          headers: {
            Authorization: `Bearer ${authtoken}`
          }
        }
      )
          .then(res => {
            setFormData({
              ...formData,
              name: '',
              email: '',
              tel: '',
              dob: '',
              textChange: 'Submitted'
            });
            toast.success(res.data.message);
            this.props.history.push('/next');
          })
          .catch(err => {
            setFormData({
              ...formData,
              name: '',
              email: '',
              tel: '',
              dob: '',
              textChange: 'Submit'
            });
            toast.error('Something went wrong with the submission');
          });
      
    } else {
      toast.error('Please fill all fields');
    }
  };
it works fine if I remove
  this.props.history.push('/next');
but it is used to redirect after the submission
what have I done wrong here and how can I fix it
or is there a different way to redirect after a submission
Thanks in advance
