const [values, setValues] = useState({ firstName: '', lastName: '', email: '' }) function handleChange(){ setValues((prevState) => const {name, value} = e.target; return { ...prevState, [name]: value; id: Date.now().toString(36) + Math.random() .toString(36).substring(2, 12).padStart(12, 0) } ) }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter