I know how to POST data from a React Native app to the server with axios, but I don’t know how I can POST data from the server to React Native. Is there a way to listen for requests from the server, or a way to handle requests to "routes" in the app (if they even exist)?
Question posted in React native
The official React Native documentation can be found here.
The official React Native documentation can be found here.
2
Answers
Either you are looking for
Sockets
(full duplex) a persistent communication channel between client and serverYou might want to read up on this topics.
What do you mean by "POST data from the server to React Native"?
React Native is client, and you can’t possibly fire a HTTP request to client. If you want to trigger something in React Native from the server, you can just use some real time bi-directional connection. Like HTTP/2 or socket.io, or just simple as long polling