what triggers formik validate

Solutions on MaxInterview for what triggers formik validate by the best coders in the world

showing results for - "what triggers formik validate"
Valerio
05 Oct 2018
1const Input = ({ field, form }) => {
2  useEffect(() => {
3    form.validateForm();
4  }, []);
5
6  return (
7    <div>
8      <input
9        style={{
10          border: form.errors[field.name] ? "1px solid red" : "1px solid #ccc"
11        }}
12        name={field.name}
13        value={field.value}
14        onChange={field.onChange}
15      />
16      {form.errors[field.name] && (
17        <span style={{ color: "red" }}>{form.errors[field.name]}</span>
18      )}
19    </div>
20  );
21};
22