小编sey*_*yed的帖子

react-hooks:跳过使用中的第一次运行

我该如何跳过第一次遇到问题useEffect

useEffect(() => {
    const first = // ???
  if (first) {
    // skip
  } else {
    // run main code
  }
}, [id]);
Run Code Online (Sandbox Code Playgroud)

reactjs react-hooks

16
推荐指数
1
解决办法
6108
查看次数

如何在“useLazyLoadQuery”中跳过请求

我如何跳过useLazyLoadQuery.

import { useLazyLoadQuery } from 'react-relay/hooks';

const id = props.selectedId // id can be a number or null
const user = useLazyLoadQuery(query, {id}) // skip query/request network if id is null
Run Code Online (Sandbox Code Playgroud)

relayjs react-hooks

2
推荐指数
1
解决办法
2141
查看次数

标签 统计

react-hooks ×2

reactjs ×1

relayjs ×1