I am trying to build an application with large json data and sending get request every 7 seconds. So, both data size and frequency are high. Should i use swr
or axios with react hooks and setinterval
. I am using ag-grid and react-vis chart to display data.
There are 12 tables in every page with 30-100 rows. I am concerned about the performance issues.
I'm new to react. I need some suggestions deciding the libraries.
The SWR library is more than just polling. One of its main functions is to provide a cache invalidation strategy. Besides, Request de-duplication, retry of exponential avoidance strategy, these functions are used out of the box, it is not recommended to implement it by yourself.
SWR first returns the data from cache (stale), then sends the fetch request (revalidate), and finally comes with the up-to-date data again.
It will give you a Real-time experience like WebSocket. Performance issues involve many aspects, using WebSocket may not be able to get good performance, you can try SWR
For more features, see features and performance
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With