I have a mongoDB,a node server, and a react-native app. What I want is when a certain field update in my mongoDB document to trigger a redux change in my react-native app. Do anyone have an idea how to achieve this ?
CodePudding user response:
I assume your react app would not have a direct connection with the mongoDb (and it should be like this). Now, whenever something updates in mongoDb, it must be from your node server. Node server can notify about the change to your react frontend in many ways, like:
- Via websockets
- Via push notifications / cloud messaging
- Server sent events
- Polling the server from your frontend app
Whenever your react app is notified for a certain event, you then trigger a change in your redux state