Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class EmployeesList extends Component {
- render() {
- return (
- <div className="EmployeesList">
- {this.state.employees.map((employee) => (
- <div className="Employee">
- {this._renderAvatar(pick(employee, ['name', 'initials', 'photoUrl']))}
- </div>
- ))}
- </div>
- );
- }
- constructor() {}
- state = {
- employees: [],
- pendingRequest: false,
- };
- getDerivedStateFromProps() {}
- componentDidMount() {
- this.setState(() => ({pendingRequest: true}));
- Ajax.get('/employees')
- .then((response) => this.setState({
- employees: response.data,
- pendingRequest: false,
- }));
- }
- shouldComponentUpdate() {}
- componentDidUpdate() {}
- _borderColor = 'blue';
- _staticEmployeeStuff = {};
- _handleAvatarClick = () => {};
- _renderAvatar = (props) => {
- const {name, initials, photoUrl} = props;
- const imgUrl = photoUrl ? photoUrl : INITIALS_BASE + initials;
- return (
- <img alt={name} onClick={this._handleAvatarClick} src={imgUrl} />
- );
- };
- }
Add Comment
Please, Sign In to add comment