Skip to content

Commit 6323c92

Browse files
author
guosw
committed
fix: values ​​are not reset when switching inputs
1 parent 1bcef98 commit 6323c92

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/components/Discuss/list.jsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { useState } from 'react'
1+
import React, { useState, useEffect } from 'react'
22
import { connect } from 'react-redux'
33
import PropTypes from 'prop-types'
44

@@ -15,6 +15,10 @@ function CommentItem(props) {
1515
const { user } = item
1616
const [value, setValue] = useState('')
1717

18+
useEffect(() => {
19+
replyVisible && setValue('')
20+
}, [replyVisible])
21+
1822
function handleChange(e) {
1923
setValue(e.target.value)
2024
}

0 commit comments

Comments
 (0)