4 ms·
As a relative newcomer jo JS frontend development, is there a canonical JS REST client library that works well with React / Flux, or do I have to write that mys
by scoot 11y ago
As a relative newcomer jo JS frontend development, is there a canonical JS REST client library that works well with React / Flux, or do I have to write that myself?
- woah 11y agoFetch is really easy to use, and is native in modern browsers. There are several polyfills as well. It eliminates the need for any libraries.
- pvg 11y agoFetch looks interesting but as far as I can tell, it's an in-progress standard with no support on any version of Safari or IE or any mobile browser whatsoever. Seems like it has a bit to go before it being 'native in modern browsers'
- callum85 11y agoYou can polyfill it in those browsers. Just use polyfill.io, or if you prefer, manually feature-detect it and if necessary load Github's fetch polyfill, which is good: https://github.com/github/fetch https://github.com/github/fetch
- scoot 11y agoThanks, appreciate the pointer - the idea of adopting something potentially a future standard through a polyfill is appealing. @pvg I take your point about lack of browser support, but that's what polyfills are for after all! :) In the meantime since asking I also came across restful.js (github [1], blog [2]) - it's new, but looks like a good framework-neutral alternative, if a little heavy at 27K minimised/uncompressed. Edit: Actually, fetch.js + es6-promise-min.js = 26K, so not much in it. [1] https://github.com/marmelab/restful.js https://github.com/marmelab/restful.js [2] http://marmelab.com/blog/2015/03/10/deal-easily-with-your-rest-api-using-restful-js.html http://marmelab.com/blog/2015/03/10/deal-easily-with-your-re...
- sgberlin 11y agoMaybe "superagent". Client side and node.