import React from 'react'; import {Link} from 'react-router-dom'; class Friend extends React.Component{ constructor(props){ super(props); this.state = { loading: true }; } componentDidMount(){ this.props.fetchAllUsers().then(()=>this.setState({loading:false})); } render(){ let count = " "; let friendIds = this.props.user.friends; if (friendIds.length === 0 || this.state.loading){ return null; }else{ count = this.props.user.friends.length; friendIds=this.props.user.friends.slice(0,9); return (

Friends [{count}]

); } } } export default Friend;