Created
December 26, 2016 23:06
-
-
Save thinkclay/553e0193364e33ca5788bbf3f02c9b7c to your computer and use it in GitHub Desktop.
This react input gets rid of form autocomplete with some little hacks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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