I’m trying to re-render my component when data changes in the future. The initial render will be <1s, but as data loads in the background, which could take up to 60-90s, the component should re-render to show a button allowing the user to load newly available data.
But I’m having lots of trouble with this:
- Using
setTimeout
insideuseEffect
has no effect, it never gets called, even when done <1-3s - Initial state for
useState
can be a promise, and shows a built-in spinner, but when >25s, the app shows an error as expected - Using
then
callback on the promise ofgetJob().getStats()
doesn’t ever get called, even when done <1-3s
Is it possible then to re-render a component with either polling (via settimeout) or callbacks (via promises)? If not, is there another way I’m missing? Thanks.