UNPKG

@airplane/views

Version:

A React library for building Airplane views. Views components are optimized in style and functionality to produce internal apps that are easy to build and maintain.

23 lines (22 loc) 505 B
import { useContext, useEffect } from "react"; import { FormContext } from "./FormProvider.js"; const useRegisterFormInput = (id, type) => { const { addFormInput, removeFormInput } = useContext(FormContext); useEffect(() => { if (id) { addFormInput(id, type); } return () => { if (id) { removeFormInput(id); } }; }, [id, type, addFormInput, removeFormInput]); }; export { useRegisterFormInput }; //# sourceMappingURL=useRegisterFormInput.js.map