State update doesn't trigger countup to update
See original GitHub issueI am trying to use this as a part of a live dashboard, but for some reason, state changes from parent components doesn’t trigger an update to useCountUp. If I use an actual number in the effect update, it triggers correctly, but state updates do not. Console logging shows that an update occured, but the counter does not adjust. Code example below:
const Data = props.data const { countUp, start, update } = useCountUp({ start: 0, end: Data(), delay: 0, duration: 1, onUpdate: () => console.log('Updated!'), }); useEffect(() => { update(Data())} ,[Data, update])
Issue Analytics
- State:
- Created 3 years ago
- Comments:5
Top Results From Across the Web
React Countup trigger start when state is true - Stack Overflow
I would like to find a way how to start is from outside of the Component. I can't figure it out how to...
Read more >Why React doesn't update state immediately - LogRocket Blog
When developing React applications, you may have noticed that state updates don't immediately reflect new values after being changed.
Read more >react-countup | Yarn - Package Manager
Complete example ; from 'react-countup' ; () => { const ; const { start, pauseResume, reset, update } = useCountUp({ ref ; 0,...
Read more >react-countup-es - npm
Forces count up transition on every component update. Default: false. preserveValue: boolean. Save previously ended number to start every new ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@wantToHawaii I know that it is something weird, but for this case you should use provided
update
function:should be ok in react-countup@5.0.0-0