{comments[comments?.length - 2]?.owner?.nick || comments[comments?.length - 2]?.owner?.login}:
{comments[comments?.length - 2]?.text}
{comments[comments?.length - 1]?.owner?.login || comments[comments?.length - 1]?.owner?.login}:
{comments[comments?.length - 1]?.text}
}
>
const FieldCommentSend = ({ postId, sentComment }) => {
const [commentValue, setCommentValue] = useState('')
const [error, setError] = useState(false)
const changeComentTextarea = (e) => {
setCommentValue(e.currentTarget.value)
setError(false)
}
const sendCommentValid = (value) => {
if (value.trim() !== '') {
sentComment(postId, value.trim())
setCommentValue('')
} else {
setError(true)
}
}
return (
<>
{error &&