从突变请求中检测新添加的项目
我有一个前端,希望将新添加的用户标记为用户(想象一下添加了一个新的待办事项,并且已经进行了拆除,并且该新项目被标记为向用户表明它是“新的”)。
我正在考虑使用LocalStorage以某种方式保存getTodolist结果的旧状态,一旦将此API倒置,它将与旧的和标记新的待办事项进行比较为“ new”。
有没有办法为我发现这一点吗?如果没有,是否有一种更干净的方法来构建它?
I have a frontend that wants to mark to users which items in a list is newly added (imagine a new to-do is added, and it is refetched and this new item is marked to show the user that it is "new").
I am thinking of using localStorage to somehow save the old state of the getToDoList result and once this API is being refetched, it will compare with the old and mark new to-dos as "new".
Is there a way for react-query to detect this for me? If not, is there a cleaner way to build this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
基于React-Query文档,您可以访问带有上下文的旧数据。
based on react-query documentation, you can access to old data with context.