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
function Input ({ callback, type = 'text', disabled = false, readOnly = false, placeholder = '' }) {
return (
<input
type={type}
disabled={disabled}
readOnly={readOnly}
<input
type={type}
disabled={disabled}
readOnly={readOnly}
placeholder={placeholder}
onChange={(event) => callback(event.target.value)}
onChange={({ target: { value }}) => callback(value)}
/>
);
}