fetch
fetch copied to clipboard
Technical planning and discussion
@cpojer I'm reaching out to follow up on a previous discussion about coming up with a custom Fetch API implementation for React Native at https://github.com/react-native-community/fetch with support for streaming (https://github.com/facebook/react-native/issues/27741). We, MOXY and Protocol Labs, are planning to start this effort shortly and we'd like to know your thoughts on the matter.
In short, what we currently have in mind is as follows:
- Rewrite whatwg-fetch in modern JS.
- Remove XHR out of the equation and implement fetch directly on top of RN's JavaScript Network API exactly for the same reasons outlined at https://github.com/react-native-community/discussions-and-proposals/issues/99.
- Assume
ReadableStream
is available in RN's environment which can be polyfilled with web-streams-polyfill. IfReadableStream
is expected to only be used in the context of Fetch, we can probably bundle them together. - Have tests in place running in an actual RN app on GitHub's CI.
Even if Facebook has no plans to add support for streaming to Fetch for the time being, app developers can easily swap out whatwg-fetch
for @react-native-community/fetch
manually. Even better would be React Native to do this automatically via some sort of extension or plugin API.
Are there any guidelines which React Native Community packages should conform to? e.g. linter and linting config, CI process config, etc.
CC @satazor @hugomrdias