diff --git a/packages/app/src/components/PostCard/components/actions/likeButton/index.jsx b/packages/app/src/components/PostCard/components/actions/likeButton/index.jsx index cb7cc217..f6aa55a2 100755 --- a/packages/app/src/components/PostCard/components/actions/likeButton/index.jsx +++ b/packages/app/src/components/PostCard/components/actions/likeButton/index.jsx @@ -4,56 +4,56 @@ import CountUp from "react-countup" import "./index.less" -export default (props) => { - const [liked, setLiked] = React.useState(props.defaultLiked ?? false) - const [clicked, setCliked] = React.useState(false) +const LikeButtonAction = (props) => { + const [liked, setLiked] = React.useState(props.defaultLiked ?? false) + const [clicked, setCliked] = React.useState(false) - const handleClick = async () => { - let to = !liked + const handleClick = async () => { + let to = !liked - setCliked(to) + setCliked(to) - if (typeof props.onClick === "function") { - const result = await props.onClick(to) - if (typeof result === "boolean") { - to = result - } - } + if (typeof props.onClick === "function") { + const result = await props.onClick(to) - setLiked(to) - } + if (typeof result === "boolean") { + to = result + } + } - return
- - -
-} \ No newline at end of file + setLiked(to) + } + + return ( +
+ + +
+ ) +} + +export default LikeButtonAction