Skip to content

Instantly share code, notes, and snippets.

@jsmanifest
Created May 17, 2020 18:03
Show Gist options
  • Save jsmanifest/216bf8a6f0fa0f68a07e59728b8972b1 to your computer and use it in GitHub Desktop.
Save jsmanifest/216bf8a6f0fa0f68a07e59728b8972b1 to your computer and use it in GitHub Desktop.
function App() {
const [value, setValue] = React.useState('')
function onChange(e, { ref }) {
console.log(`current state value: ${value}`)
console.log(`incoming value: ${e.target.value}`)
setValue(e.target.value)
console.log(`current state value now: ${value}`)
}
function onChange2(e) {
e.concat(['abc', {}, 500])
}
function onChange3(e) {
console.log(e.target.value)
}
return (
<div>
<MyInput
value={value}
onChange={onChange}
onChange2={onChange2}
onChange3={onChange3}
/>
</div>
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment