import React, { useState } from 'react'; import PropTypes from 'prop-types'; import ReactRouterPropTypes from 'react-router-prop-types'; import UserInfo from './UserInfo'; import Avatar from './Avatar'; export function Friends({ match }) { return ; } export function Readers({ match }) { return ; } function Users(props) { const [user, setUser] = useState({ uid: 0, uname: props.user }); return ( { user[props.prop] && user[props.prop].map(user => ) } ); } Friends.propTypes = { match: ReactRouterPropTypes.match.isRequired }; Readers.propTypes = { match: ReactRouterPropTypes.match.isRequired }; Users.propTypes = { user: PropTypes.string.isRequired, prop: PropTypes.string.isRequired };