I try using Progress
from antd
. I use it in my react function component:const [percent, setpercent] = useState(0)
if I use it directly in my onclick
event, it works perfectly.
<div onClick={(e)=>{setpercent(10)}} >
click me
</div>
but if I use function to trigger the change:
function handlepercent(v){
setpercent(v)
}
the value in the Progress
will update, but it is not animated.
Not sure if it is the bug or is there something wrong with the code.
1条答案
按热度按时间kpbwa7wx1#
请检查下面的代码
https://codesandbox.io/s/suspicious-estrela-liz522?file=/src/App.js