import React from 'react'; import PropTypes from 'prop-types'; import { UserType } from './Types'; import UserInfo from './UserInfo'; import Avatar from './Avatar'; export function Friends({ user, ...rest }) { return ; } export function Readers({ user, ...rest }) { return ; } class Users extends React.Component { constructor(props) { super(props); this.state = { user: {} }; } updateUser = (user) => { this.setState({ user: user }); } render() { return (
{ this.state.user[this.props.prop] && this.state.user[this.props.prop].map(user => ) }
); } } Friends.propTypes = { user: PropTypes.string.isRequired }; Readers.propTypes = { user: PropTypes.string.isRequired }; Users.propTypes = { user: PropTypes.string.isRequired, prop: PropTypes.string.isRequired };