Update Input.md

This commit is contained in:
Angelos Chalaris
2018-12-10 10:13:49 +02:00
committed by GitHub
parent 09a8722068
commit aefbbb93d3

View File

@ -6,14 +6,13 @@ Use object destructuring to set defaults for certain attributes of the `<input>`
Render an `<input>` element with the appropriate attributes and use the `callback` function in the `onChange` event to pass the value of the input to the parent. Render an `<input>` element with the appropriate attributes and use the `callback` function in the `onChange` event to pass the value of the input to the parent.
```jsx ```jsx
function Input ({ callback, type = 'text', disabled = false, readonly = false, placeholder = '', value = '' }) { 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}
value={value}
onChange={(event) => callback(event.target.value)} onChange={(event) => callback(event.target.value)}
/> />
); );