Data on fetch must be updated everytime like realtime data

Im thinking now that if i setinterval the fetch everytime i might cause performance issue. How to have the right way to get realtime data on fetch get method.
2 Replies
lxsmnsyc
lxsmnsyc12mo ago
there's no accurate real-time for fetch. setInterval is fine, but there are many ways, or you can just use data-fetching libraries that emulate this behavior (e.g. tanstack-query where it re-fetches when user refocuses the page, changes page visibility, goes online, etc)
navi.ToTskie
navi.ToTskieOP12mo ago
Oh okay. I heard tanstack before so this is how it use for. Thanks Question which is prefer websocket or tanstack? I forgot to mention i already used redis. I think i can set interval this its redundat to used more state management am i roght?
Want results from more Discord servers?
Add your server