JSFiddle - React, Tailwind, and code Playground

by Simon

JavaScript

const UserList = props => (
  <List>
    {props.users
      .map(user => <UserCard key={user.id} user={user} />)}
  </List>
);

UserList.propTypes = {
  users: React.PropTypes.arrayOf(userShape).isRequired,
};

const UserListWithEmpy = branch(
  props => props.users.length,
  UserList,
  () => <Warning>Empty</Warning>,
);

const Users = branch(
  props => props.users,
  UserListWithEmpy,
  Loading
);

export default Users;