Skip to content

Instantly share code, notes, and snippets.

@thinkclay
Created December 26, 2016 23:06
Show Gist options
  • Save thinkclay/553e0193364e33ca5788bbf3f02c9b7c to your computer and use it in GitHub Desktop.
Save thinkclay/553e0193364e33ca5788bbf3f02c9b7c to your computer and use it in GitHub Desktop.
This react input gets rid of form autocomplete with some little hacks
const Input = (props) => {
const onFocus = (e) => {
let input = e.target
if (input.hasAttribute('readonly'))
{
input.removeAttribute('readonly')
input.blur()
input.focus()
}
}
return (
<input
{...props}
onFocus={onFocus}
autoComplete="false"
/>
)
}
export default Input
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment