Closed blockchain5992 closed 1 year ago
Hi, could you please provide an example of how you are using it?
I am fetching date param from backend and want to show countdown timer for my contest. So I am adding Countdown component in return like this: <Countdown date={ abc?.xyz } renderer={renderer} /> const renderer = ({ days, hours, minutes }) => { // Render a countdown return (
);
};
So when I am opening my page it will not loaded and I got maximum depth limit reached error.
This alone shouldn't lead to an issue like that, given that the examples work. Do you have an example of what the date
can be?
Hi, is this still happening for you?
i'm also facing this issue when trying to update state in renderer function!
Hi, you should avoid updating the state in any render function in React since state updates result in a rerender (and then the cycle starts again, and again => infinite loop) unless you manually prevent it in one of the other lifecycle methods.
I think oncomplete callback will handle the state updates right?
It depends on what you would like to achieve, but yes, you could update the state in one of the callbacks, e.g., onComplete
.
Thank you! I fixed my issue.
I'm closing this. Please feel free to re-open or create a new issue if you still encounter this problem!
I am getting maximum depth reached error while adding as a timer in my application