在使用useEffect时,当我们将函数的声明放在useEffect函数外面时,会报eslint警告
React Hook useEffect has a missing dependency: 'clickshow'.
Either include it or remove the dependency array react-hooks/exhaustive-deps
解决方法:
1.使用 // eslint-disable-line react-hooks/exhaustive-deps
useEffect(() => {
clickshow()
}, [showConfirmation])// eslint-disable-line react-hooks/exhaustive-deps
function clickshow() {
if (showConfirmation) {
document.