useLazyQuery causing too many re-renders [Apollo/ apollo/react hooks]

后端 未结 3 1801
忘掉有多难
忘掉有多难 2021-01-21 14:01

I\'m building a discord/slack clone. I have Channels, Messages and users. As soon as my Chat component loads, channels get fetched with useQuery hook from Apollo.<

3条回答
  •  没有蜡笔的小新
    2021-01-21 14:26

    You could use the called variable return by useLazyQuery.

    !called && fetchMessages({ variables: { channelid: channelidData.channelid } });

提交回复
热议问题