[英]How to sync data between users ReactJS
I want to know if there is a way to have data be linked between different users.我想知道是否有办法在不同用户之间链接数据。 In my case I'm building a gift wish list and each item has a buy button attached to it.就我而言,我正在建立一个礼物愿望清单,每个物品都附有一个购买按钮。 if the buy button is clicked and someone buys the item then the item no longer needs to be displayed.如果单击购买按钮并且有人购买了该项目,则不再需要显示该项目。 but i have no idea how sync that data between users.但我不知道如何在用户之间同步这些数据。 I tried using sqlite but I wasn't able to find a way to store the data that is returned from db.each
since its asynchronous.我尝试使用 sqlite 但我无法找到一种方法来存储从db.each
返回的数据,因为它是异步的。 I also thought of JSON but there didn't seem to be a good way to write to an external JSON file.我也想到了 JSON 但似乎没有写入外部 JSON 文件的好方法。 I know that I can't be the only one with this issue but I don't really know what to search in order to find the answers I'm looking for.我知道我不能成为唯一遇到此问题的人,但我真的不知道要搜索什么才能找到我正在寻找的答案。
TIA TIA
Three approaches I would suggest.我建议的三种方法。 (The problem isn't really tied to ReactJS) (问题与 ReactJS 无关)
1. Reactive Approach 1. 反应式方法
2. Real Time Approach 2.实时方法
3. Near Real Time Approach 3. 近实时方法
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.