Skip to content

Instantly share code, notes, and snippets.

View SoyRol4ndo's full-sized avatar

Rolando Llanes SoyRol4ndo

View GitHub Profile
@SoyRol4ndo
SoyRol4ndo / machine.js
Last active October 5, 2023 16:37
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@SoyRol4ndo
SoyRol4ndo / useForm.tsx
Created September 22, 2023 12:33 — forked from Klerith/useForm.tsx
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