So I am learning React and was wondering about keeping a component in sync with the db. Is there a way other than constantly making an ajax call to the server using an interval , to update the component state? Also, what would be the ideal way to approach this?
Asked
Active
Viewed 1,360 times
0
-
Possible duplicate of [Why would one use the Publish/Subscribe pattern (in JS/jQuery)?](https://stackoverflow.com/questions/13512949/why-would-one-use-the-publish-subscribe-pattern-in-js-jquery) – bennygenel Oct 21 '17 at 18:25
1 Answers
0
I think you wanna do something like push notification, you could use to https://socket.io/ And send a notification from the server to front, if anything happens.

joelbarbosa
- 97
- 5
-
Wouldn't keeping a two way connection/ stream open be a bit of an overkill just to keep a check on the state? P.S. What would be the impact of such a connection on the server load? – Jagwant Sehgal Oct 26 '17 at 20:29