Skip to content

Instantly share code, notes, and snippets.

View AlanDev24's full-sized avatar
👻
I may be slow to respond.

Alan Gonzalez AlanDev24

👻
I may be slow to respond.
View GitHub Profile
@AlanDev24
AlanDev24 / useForm.js
Last active July 22, 2024 04:13
useForm - Custom hook for react
import { useEffect, useMemo, useState } from 'react';
export const useForm = ( initialForm = {}, formValidations = {}) => {
const [ formState, setFormState ] = useState( initialForm );
const [ formValidation, setFormValidation ] = useState({});
useEffect(() => {
createValidators();
}, [ formState ])