Skip to content

Instantly share code, notes, and snippets.

@layerok
layerok / usePersistFormik.ts
Last active May 6, 2024 23:46
persist formik
import { FormikValues, useFormik as useFormikBase } from "formik";
import { ChangeEvent, useCallback, useState } from "react";
export const usePersistFormik = <Values extends FormikValues = FormikValues>(
formik: ReturnType<typeof useFormikBase<Values>>,
opts: {
storageKey: string;
},
) => {