You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
when i click on like button its LikeCount is successFully Increase but it is not
this is my scream component
`import React,{Fragment,useEffect} from 'react'
import withStyles from '@material-ui/core/styles/withStyles'
import Card from '@material-ui/core/Card'
import CardContent from '@material-ui/core/CardContent'
import CardMedia from '@material-ui/core/CardMedia'
import Typography from '@material-ui/core/Typography'
import {Link} from 'react-router-dom'
import dayjs from 'dayjs'
import relativeTime from 'dayjs/plugin/relativeTime'
import {connect} from 'react-redux'
import {likeScream,unlikeScream} from '../redux/actions/dataAction'
//icon
import FavoriteIcon from '@material-ui/icons/Favorite';
import FavoriteBorderIcon from '@material-ui/icons/FavoriteBorder';
import CommentIcon from '@material-ui/icons/Comment';
import ToolButton from './ToolButton'
import LikeButton from './LikeButton'
when i click on like button its LikeCount is successFully Increase but it is not
this is my scream component
`import React,{Fragment,useEffect} from 'react'
import withStyles from '@material-ui/core/styles/withStyles'
import Card from '@material-ui/core/Card'
import CardContent from '@material-ui/core/CardContent'
import CardMedia from '@material-ui/core/CardMedia'
import Typography from '@material-ui/core/Typography'
import {Link} from 'react-router-dom'
import dayjs from 'dayjs'
import relativeTime from 'dayjs/plugin/relativeTime'
import {connect} from 'react-redux'
import {likeScream,unlikeScream} from '../redux/actions/dataAction'
//icon
import FavoriteIcon from '@material-ui/icons/Favorite';
import FavoriteBorderIcon from '@material-ui/icons/FavoriteBorder';
import CommentIcon from '@material-ui/icons/Comment';
import ToolButton from './ToolButton'
import LikeButton from './LikeButton'
const style = {
card : {
display : 'flex',
marginBottom : 20,
},
image : {
minWidth : 200,
}
function Scream({classes,scream,scream : {body , createdAt , imageUrl , userHandle , Screamid , likeCount , commentCount },user }) {
dayjs.extend(relativeTime)
}
const mapStateToProps = (state) => ({
user : state.user
})
export default connect(mapStateToProps)(withStyles(style)(Scream))
`
and this is my LikeButton component
`import React,{Fragment} from 'react'
import {connect} from 'react-redux'
import FavoriteIcon from '@material-ui/icons/Favorite';
import FavoriteBorderIcon from '@material-ui/icons/FavoriteBorder';
import ToolButton from './ToolButton'
import {Link} from 'react-router-dom'
import {likeScream,unlikeScream} from '../redux/actions/dataAction'
function LikeButton({user,Screamid,unlikeScream,likeScream}) {
const isLiked = () => {
if(user.likes && user.likes.find(like => like.Screamid === Screamid)){
}
const mapStateToProps = (state) => ({
user: state.user
});
const mapActionsToProps = {
likeScream,
unlikeScream
};
export default connect(
mapStateToProps,
mapActionsToProps
)(LikeButton);
please help me out
The text was updated successfully, but these errors were encountered: