May 2018
Intermediate to advanced
470 pages
13h 54m
English
We will create a separate component for the follow button called FollowProfileButton, which will be added to the Profile component. This component will show either Follow or Unfollow buttons depending on whether the current user is already a follower of the user in the profile. The FollowProfileButton component will be as follows.
mern-social/client/user/FollowProfileButton.js:
class FollowProfileButton extends Component { followClick = () => { this.props.onButtonClick(follow) } unfollowClick = () => { this.props.onButtonClick(unfollow) } render() { return (<div> { this.props.following ? (<Button variant="raised" color="secondary" onClick= {this.unfollowClick}>Unfollow</Button>) : (<Button variant="raised" color="primary" ...Read now
Unlock full access