腾讯云
开发者社区
文档
建议反馈
控制台
首页
学习
活动
专区
工具
TVP
最新优惠活动
文章/答案/技术大牛
搜索
搜索
关闭
发布
登录/注册
精选内容/技术社群/优惠产品,
尽在小程序
立即前往
文章
问答
(1248)
视频
沙龙
1
回答
如何将附加依赖项传递给自定义钩子
reactjs
我使用自定义钩子将初始数据加载到组件中。它可以正常工作,但我会收到警告,因为我将动态构造的依赖项传递给我的useEffect钩子: React被传递给了一个非数组文本的依赖列表。这意味着我们不能静态地验证您是否传递了正确的依赖项下面是我的自定义钩子的代码:const useApiData = (path: string, dependancies: any[], defaultValue: any) => { const modelTemplate = { isLoading: true,
浏览 2
提问于2020-05-28
得票数 2
回答已采纳
1
回答
typescript
es-lint
错误
:
react-hooks
/
exhaustive
deps
reactjs
、
typescript
、
react-hooks
我最初认为这是一个假阳性,但直到现在我都不知道为什么这个
错误
是有帮助的。当你的外部道具函数在useEffect中使用时,如何判断
react-hooks
/
exhaustive
-
deps
错误
不需要依赖?
浏览 22
提问于2020-04-10
得票数 1
回答已采纳
3
回答
eslint vscode插件没有为钩子生成警告。
reactjs
、
visual-studio-code
、
create-react-app
、
eslint
module" plugins: ["react"], "react/prop-types": [0], "
react-hooks
/
exhaustive
-
deps
": "warn"};
浏览 1
提问于2019-09-14
得票数 3
回答已采纳
2
回答
如何禁用@
typescript
-eslint/no-null断言规则
typescript
、
eslint
id警告禁止非空断言@
typescript
-eslint/no-null断言 module.exports = { 'plugin:@
typescript
-eslint/recommended', 'plugin:react/recommended','
浏览 2
提问于2020-02-20
得票数 32
回答已采纳
1
回答
在UseEffect中使用`dispatch`钩子
javascript
、
reactjs
当我的React组件卸载时,我想要dispatch一些动作。因为我使用的是钩子,所以不能使用componentWillUnmount。相反,我使用的是useEffect钩子:useEffect(() => () => dispatch(setValue()), []); 上面的代码抛出警告"React Hook useEffect has a missing dependency:'dispatch'.要么包含它,要么删除依赖数组“。我不能在依赖数组中包含dispatch,因为它会导致useE
浏览 0
提问于2020-05-08
得票数 0
2
回答
“未定义的TypeError:破坏不是函数”的
错误
反应
javascript
、
reactjs
、
react-hooks
我附加了导致
错误
的代码。user.dstoreName) { return null; // eslint-disable-next-line
react-hooks
/
exhaustive
-
deps
<> {!
浏览 9
提问于2022-10-31
得票数 1
回答已采纳
1
回答
在打字稿中启用react eslint插件。tslint中没有插件
reactjs
、
typescript
、
eslint
、
tslint
我尝试将它添加到我的tslint.json中:"rules: { "
react-hooks
/
exhaustive
-
deps
": "warn",Could not
浏览 0
提问于2019-02-23
得票数 2
回答已采纳
1
回答
如何在
typescript
eslint配置中启用标准命名约定的警告?
typescript
、
eslint
我想在我的.eslintrc.json文件中启用对“默认”
typescript
命名约定的警告。您如何做到这一点? //..."@
typescript
-eslint/eslint-plugin": "^4.25.0", "easy-peasy", &qu
浏览 30
提问于2021-05-28
得票数 0
回答已采纳
4
回答
如何修复"React有一个缺少的依赖项。要么包含它,要么删除依赖数组“问题?
reactjs
、
typescript
、
react-redux
、
react-hooks
、
react-typescript
我想使用useEffect,但是当我添加getUpperGroup方法时,我会收到警告:useEffect(() => { setContentData(contentGroupData); const [contentData, setContentData] = useState<Fundation[]>([] as Fundation[]
浏览 3
提问于2020-10-23
得票数 11
回答已采纳
1
回答
在useEffect钩子中使用redux操作创建器时,禁用
react-hooks
/
exhaustive
deps
警告时出现问题
reactjs
、
react-redux
、
react-hooks
、
eslint
Either include it or remove the dependency array
react-hooks
/
exhaustive
-
deps
这是useEffect钩子- const {getPlanQuotes } = props; getPlanQuotes(); }, []); 所以我试着用// eslint-disable-next-line
react-hooks
/
exhaustive
-<em
浏览 47
提问于2020-01-28
得票数 1
回答已采纳
2
回答
避免向useEffect添加不必要的依赖项
javascript
、
reactjs
、
redux
、
react-redux
、
eslint
如果我忽视了埃斯林特的
错误
,这会是个问题吗?另外,我不知道React为什么要我在依赖数组中添加所有内容。如果当依赖项数组中的某些内容发生变化时,我不希望useEffect运行呢?
浏览 2
提问于2022-06-02
得票数 5
1
回答
函数作为依赖反应-类型记录
reactjs
、
typescript
你好,我有一个问题函数,因为依赖破坏了应用程序。问题是,当我在getIngredientValues依赖项中没有useCallback时,IDE会抛出并出错。该怎么办呢? (ingredient: ingredient, isValid: boolean, isWrong: boolean) => { values: ingredient, isValid:
浏览 5
提问于2022-04-07
得票数 -1
1
回答
反应钩,ComponentDidMount
reactjs
、
react-hooks
(
deps
钩子/详尽的-
deps
) 如果我将依赖数组从[]更改为在每个呈现上运行[props] useEffect,我只想在第一次运行它,就像componentDidMount一样。
浏览 0
提问于2020-08-15
得票数 1
回答已采纳
1
回答
React Hook useEffect缺少依赖项(在上下文中定义的函数)
react-hooks
、
react-context
、
use-effect
我收到
错误
: React Hook缺少依赖项:'setSelectedPage‘。包括它或删除依赖数组
react-hooks
/
exhaustive
deps
const { setPage } = useContext(GlobalContext
浏览 0
提问于2020-02-13
得票数 0
2
回答
React缺少一个空数组依赖项的依赖项
reactjs
、
use-effect
我正在收到缺少依赖的警告。我的代码 const fetchFeatured = () => { setFeatured(snapsho
浏览 5
提问于2022-06-08
得票数 0
回答已采纳
3
回答
如何全局禁用
react-hooks
/
exhaustive
deps
eslint警告?
reactjs
、
react-hooks
、
eslint
"
react-hooks
" "rules": { "
react-hooks
/
exhaustive
-
deps
": "off"/0 // trie
浏览 369
提问于2020-09-20
得票数 4
1
回答
React Hook useEffect缺少.missing依赖项:“Score”、“props”和“windowDimension
reactjs
、
react-hooks
、
dependencies
useEffect(()=>{ if(gameEnd){} setScore(prev=>({ XScore: 0, })); const tempClickAddress = []; for (var i = 1; i <
浏览 27
提问于2021-01-28
得票数 0
3
回答
未在VS代码中显示的react钩子/详尽的-dep
reactjs
、
react-hooks
、
eslint
我有一个包含以下规则的.eslintrc文件: "prettier/prettier": "error", "
react-hooks
/
exhaustive
-
deps
": "error", "no-console&qu
浏览 10
提问于2022-02-10
得票数 3
6
回答
没有找到规则“react钩子/详尽-
deps
”的定义。
javascript
、
reactjs
、
react-hooks
、
eslint
、
standardjs
在我的代码中添加// eslint-disable-next-line
react-hooks
/
exhaustive
-
deps
后,我将得到下面的eslint
错误
。8:14没有找到规则“react钩子/详尽-
deps
”的
错误
定义。 我参考了 post来解决这个问题,但是上面提到的解决方案在我的情况下不起作用。有什么线索可以阻止这个
错误
吗?
浏览 9
提问于2020-01-06
得票数 51
回答已采纳
2
回答
useEffect用于componentDidMount依赖项
reactjs
requestPatientsApi(); try { const { data } = await get<A
浏览 0
提问于2019-09-06
得票数 0
点击加载更多
扫码
添加站长 进交流群
领取专属
10元无门槛券
手把手带您无忧上云
相关
资讯
Deno 1.0即将发布,你需要知道的都在这里了
前端中的 Pipeline
通过前端工程化将 Apollo 引入现有 React 技术栈
热门
标签
更多标签
云服务器
ICP备案
实时音视频
即时通信 IM
对象存储
活动推荐
运营活动
广告
关闭
领券