next.js - Can't modify storage LiveObject while using liveblocks - Stack Overflow

I am trying to implement a storage LiveObject, when I try to modify it using set method, inside useMuta

I am trying to implement a storage LiveObject, when I try to modify it using set method, inside useMutation hook, it gives error "TypeError: thisCentralCard.set is not a function" :

Below is the useMutation hook I tried implementing, which is similar to the example shown in liveblocks storage tutorial.

const updateCentralCard = useMutation(({ storage }, newCard: Card) => {
    const thisCentralCard = storage.get("centralCard") as LiveObject<{color: string, value: string}>;
    console.log(thisCentralCard)
    
    thisCentralCard.set("color", newCard.color);
    thisCentralCard.set("value", newCard.value);
  }, []);

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745665450a4639095.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信