import React from "react"; import {useNavigate} from "react-router-dom"; import CenteredContainer from "../UtilComponents/CenteredContainer"; import '../UtilComponents/App.css' const AddCar = (props) => { // eslint-disable-next-line react-hooks/rules-of-hooks const navigate = useNavigate(); // eslint-disable-next-line react-hooks/rules-of-hooks const [formData, updateFormData] = React.useState({ licensePlate : "", make : "", model : "", year : "", }) const handleChange = (e) => { updateFormData({ ...formData, [e.target.name]: e.target.value.trim() }) } const onFormSubmit = (e) => { e.preventDefault(); const licensePlate = formData.licensePlate const make = formData.make const model = formData.model const year = formData.year const driverId = localStorage.getItem("driverId"); props.onAddCar(driverId, licensePlate, make, model, year); navigate("/home") } return(

Add a car











) } export default AddCar;