I'm new to reactjs and I've been reading on how to get and post data from api. I've seen these two, but I'm not sure what to use and what's the difference between the two? I read it but I'm not sure what will I use. Thanks!
react-fetch allows you to use a component(JSX) instead of writing specific JS code. Under the hood, it uses the original fetch function(or isomorphic-fetch, not really relevant to your question).
I would suggest reading about fetch on MDN before getting to a decision.
Which should you use? Depends on your personal preferences. If you don't have any experience with fetch, I'd use whatwg-fetch to understand how it works better. Once you have a better understanding of it, you can then choose between the two libraries. If you have a simple AJAX request, consider using react-fetch. If the situation requires mutating state, or some other complex logic, I'd suggest using whatwg-fetch.
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