Skip to content

Instantly share code, notes, and snippets.

@gaperton
Created April 23, 2019 22:15
Show Gist options
  • Select an option

  • Save gaperton/13845da4b654e365aa04bb32ca7f8e54 to your computer and use it in GitHub Desktop.

Select an option

Save gaperton/13845da4b654e365aa04bb32ca7f8e54 to your computer and use it in GitHub Desktop.
// Minimal working example demonstrating the two-way data binding with React Hook.
import React, { useState } from 'react'
export const MyCoolComponent = () => {
const [ name, setName ] = useState( '' );
return (
<input value={ name }
onChange={ e => setName( e.target.value ) }
/>
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment