import React from 'react' import styles from './upDownVote.module.css' export default function UpDownVote({ onUp, onDown, onClear, upvotes, downvotes, userId, disabled, }) { const upvoted = upvotes.includes(userId) const downvoted = downvotes.includes(userId) return (
{ e.stopPropagation() if (disabled) { return } if (!upvoted) { onUp() } else { onClear() } }} >
👍
{upvotes.length}
{ e.stopPropagation() if (disabled) { return } if (!downvoted) { onDown() } else { onClear() } }} >
👎
{downvotes.length}
) }