21 lines
455 B
JavaScript
21 lines
455 B
JavaScript
import React from 'react';
|
|
|
|
|
|
class Input extends React.Component {
|
|
|
|
read(e){
|
|
this.props.update(this.props.id, e.target.value)
|
|
}
|
|
|
|
render(){
|
|
switch (this.props.type) {
|
|
case 'submit':
|
|
return <input type="submit" value={this.props.lable} onClick={this.props.submit} />
|
|
default:
|
|
return <input type={this.props.type} placeholder={this.props.lable} onChange={this.read.bind(this)} />
|
|
}
|
|
}
|
|
}
|
|
|
|
export default Input;
|