import { rateAnswer } from '@agent/api'; import { thumbDown, thumbUp } from '@agent/icons'; import { useEffect, useState } from '@wordpress/element'; import { __ } from '@wordpress/i18n'; import { Icon } from '@wordpress/icons'; import classnames from 'classnames'; export const Rating = ({ answerId }) => { const [rating, setRating] = useState(undefined); useEffect(() => { if (!answerId) return; if (rating === undefined) return; rateAnswer({ answerId, rating }); }, [rating, answerId]); return (
); };