What made me use SWR?

I have been working on a project which have multiple screens and since I am using react I have to deal with several components but when it came to data fetching it wasn’t easy to use the hook called useEffect, I was able to control the useEffect functi…

I have been working on a project which have multiple screens and since I am using react I have to deal with several components but when it came to data fetching it wasn’t easy to use the hook called useEffect, I was able to control the useEffect functionalities to some extent using dependency array but the component was mounting and unmounting which made it to refetch the data every single time.
When I learnt about SWR it kind of gave so many functionalities that I could use to control the number of refetches so the first thing I used was, dedupingInterval here I can set the time interval when I need to refetch the data.
Second thing which I used was,
mutate(key): what are the other scenarios I would like to refetch or I can say invalidate the old call.


Print Share Comment Cite Upload Translate
APA
Aastha Pandey | Sciencx (2024-03-28T21:16:09+00:00) » What made me use SWR?. Retrieved from https://www.scien.cx/2021/05/12/what-made-me-use-swr/.
MLA
" » What made me use SWR?." Aastha Pandey | Sciencx - Wednesday May 12, 2021, https://www.scien.cx/2021/05/12/what-made-me-use-swr/
HARVARD
Aastha Pandey | Sciencx Wednesday May 12, 2021 » What made me use SWR?., viewed 2024-03-28T21:16:09+00:00,<https://www.scien.cx/2021/05/12/what-made-me-use-swr/>
VANCOUVER
Aastha Pandey | Sciencx - » What made me use SWR?. [Internet]. [Accessed 2024-03-28T21:16:09+00:00]. Available from: https://www.scien.cx/2021/05/12/what-made-me-use-swr/
CHICAGO
" » What made me use SWR?." Aastha Pandey | Sciencx - Accessed 2024-03-28T21:16:09+00:00. https://www.scien.cx/2021/05/12/what-made-me-use-swr/
IEEE
" » What made me use SWR?." Aastha Pandey | Sciencx [Online]. Available: https://www.scien.cx/2021/05/12/what-made-me-use-swr/. [Accessed: 2024-03-28T21:16:09+00:00]
rf:citation
» What made me use SWR? | Aastha Pandey | Sciencx | https://www.scien.cx/2021/05/12/what-made-me-use-swr/ | 2024-03-28T21:16:09+00:00
https://github.com/addpipe/simple-recorderjs-demo