English 中文(简体)
投票率低 窗口上的成绩没有重点,恢复重点
原标题:Disable short polling for RTK Query on window not focused and revalidate on resume focus

我正在使用Reux工具包和RTK Query,管理APIC电话和我康复申请中的各州。

对于一名特定亚特兰大的人,我试图用短的投票来缓解实时的最新情况影响,并用AAP减员中定义的APICA,

  const { data, error, isLoading } = useGetAPIQuery(
    {},
    { pollingInterval: 5000 }
  );

然而,我希望当用户离开窗户时,即停止短投票,例如把有重点的制片改成另一表,一旦窗户再次集中,重新验证数据。

是否可以通过RTK查询?

Similiar问题还作为问题在上公布。

最佳回答
问题回答

您可以使用<代码>-即使用-window-focus等一揽子办法检测重点。

  const windowFocused = useWindowFocus();
  const { data, error, isLoading } = useGetAPIQuery(
    {},
    { pollingInterval: windowFocused  ? 5000 : false }
  );




相关问题
How to use one react app into another react app?

I have two react apps, parent app and child app. and child app have an hash router. I have build the child app using npm run build, It creates build folder. That build folder moved into inside the ...

how to get selected value in Ant Design

I want to print the selected value, and below is my option list: const vesselName = [ { value: 0 , label: ALBIDDA , }, { value: 1 , label: ALRUMEILA , }, { value: 2 ,...

How to add a <br> tag in reactjs between two strings?

I am using react. I want to add a line break <br> between strings No results and Please try another search term. . I have tried No results.<br>Please try another search term. but ...

热门标签