23 lines
737 B
TypeScript
23 lines
737 B
TypeScript
import React from "react";
|
|
import { useFormik } from "formik";
|
|
import { emptyInternship, Internship } from "../data/internship";
|
|
import { Nullable } from "../helpers";
|
|
import { TextField } from "@material-ui/core";
|
|
|
|
export type InternshipFormProps = {
|
|
|
|
}
|
|
|
|
export const InternshipForm: React.FunctionComponent<InternshipFormProps> = props => {
|
|
const formik = useFormik<Nullable<Internship>>({ onSubmit: values => console.log(values), initialValues: emptyInternship });
|
|
|
|
const formikProps = (prop: keyof Internship) => ({ onChange: formik.handleChange, value: formik.values[prop], name: prop })
|
|
|
|
return (
|
|
<div className="internship-form">
|
|
<TextField {...formikProps("startDate")} />
|
|
</div>
|
|
)
|
|
}
|
|
|