import React, { useState } from "react"; import { Link, useNavigate } from "react-router-dom"; import { useDispatch } from "react-redux"; import { addEducation } from "../../actions/profile"; const AddEducation = () => { const navigate = useNavigate(); const dispatch = useDispatch(); const [formData, setFormData] = useState({ school: "", degree: "", fieldofstudy: "", from: "", to: "", current: false, description: "", }); const { school, degree, fieldofstudy, from, to, description, current } = formData; const onChange = (e) => setFormData({ ...formData, [e.target.name]: e.target.value }); return (

Add Your Education

Add any school or bootcamp that you have attended

* = required field
{ e.preventDefault(); await dispatch(addEducation(formData)).then(() => navigate("/dashboard")); // i have no idea how this works used to work, i removed the navigate function from the addEducation and it does now }} >

From Date

setFormData({ ...formData, current: !current })} />{" "} Current School

To Date