update input to use destructuring

This commit is contained in:
Stefan Feješ
2018-12-12 10:47:23 +01:00
parent cb1bc41371
commit 2c028c02ae

View File

@ -8,12 +8,12 @@ Render an `<input>` element with the appropriate attributes and use the `callbac
```jsx ```jsx
function Input ({ callback, type = 'text', disabled = false, readOnly = false, placeholder = '' }) { function Input ({ callback, type = 'text', disabled = false, readOnly = false, placeholder = '' }) {
return ( return (
<input <input
type={type} type={type}
disabled={disabled} disabled={disabled}
readOnly={readOnly} readOnly={readOnly}
placeholder={placeholder} placeholder={placeholder}
onChange={(event) => callback(event.target.value)} onChange={({ target: { value }}) => callback(value)}
/> />
); );
} }