-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathUserList.js
35 lines (32 loc) · 823 Bytes
/
UserList.js
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
import React from "react";
import User from "./User";
import "./User.css";
import { Route , withRouter} from 'react-router-dom';
class UserList extends React.Component {
constructor(props){
super(props);
}
addUser(e) {
this.props.history.push('/users/add/')
}
render() {
return (
<div className="main-div">
<button className="button button-new" onClick={(e) => this.addUser(e)}>Add User</button>
<table>
<thead>
<tr>
<th>Name</th>
<th>Last name</th>
<th>E-mail</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
{this.props.contacts.map(c => <User key={c.id} user={c} />)}
</tbody>
</table>
</div>)
}
}
export default withRouter(UserList);