-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.jsx
More file actions
46 lines (36 loc) · 1021 Bytes
/
Copy pathindex.jsx
File metadata and controls
46 lines (36 loc) · 1021 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import { connect } from 'react-redux';
import React, { Component, PropTypes } from 'react';
import { Button, Input } from 'react-bootstrap';
class AddComentForm extends Component {
state = { value: '' }
static propTypes = {
addComment: PropTypes.func,
}
onChange = (e) => {
this.setState({ value: e.target.value });
}
addComment = () => {
this.props.addComment(this.state.value);
this.setState({ value: '' });
}
render() {
return (
<div>
<form>
<Input
value={this.state.value}
onChange={this.onChange}
type='textarea'
label='comment'
/>
<Button onClick={this.addComment}>add coment</Button>
</form>
</div>
);
}
}
import { addComment } from '../state';
export default connect(
null,
{ addComment }
)(AddComentForm);