Skip to content

Instantly share code, notes, and snippets.

View SoyRol4ndo's full-sized avatar

Rolando Llanes SoyRol4ndo

View GitHub Profile
@Klerith
Klerith / useForm.tsx
Last active September 29, 2023 22:35
Hook para el manejo de formularios
import { useState } from 'react';
export const useForm = <T extends Object>( initState: T ) => {
const [state, setState] = useState( initState );
const onChange = ( value: string, field: keyof T ) => {
setState({
...state,
[field]: value