这是第一次海报。总的来说,我是个新手& JS,我一直在NextJS工作。有趣的是,我的项目在运行next dev时运行得很好,但是当我使用next build时却失败了。
我得到以下错误:
Error: React Hook "useFunction" cannot be called inside a callback. React Hooks must be called in a React function component or a custom React Hook function. react-hooks/rules-of-hooks
关于useFu
我是否正确地说,不可能使用 eslint插件与tslint?
我尝试将它添加到我的tslint.json中:
"plugins": ["react-hooks"],
"rules: {
"react-hooks/rules-of-hooks": "error",
"react-hooks/exhaustive-deps": "warn",
但是,我在控制台中看到了以下错误:
Could not find implementations for the following rules
刚把react从v16更新到v17,得到了错误,编译失败。 Line 37:9: React Hook "Api.useAuth" is called conditionally. React Hooks must be called in the exact same order in every component render react-hooks/rules-of-hooks
Line 47:9: React Hook &
我在使用usestate()钩子进行状态操作后遇到问题。
无法编译错误:
./src/App.js
Line 6:43: React Hook "useState" is called in function "app" which is neither a React function component or a custom React Hook function react-hooks/rules-of-hooks
Line 14:39: React Hook "useState" is called in functio
我使用的是VSCode,当我将行'react-hooks/exhaustive-deps': 'warn'添加到我的.eslintrc.js中时,会在ESLint输出中得到以下内容:
Rules with suggestions must set the `meta.hasSuggestions` property to `true`. Occurred while linting
C:\Users\filepath.jsx:72 Rule: "react-hooks/exhaustive-deps"
这就破坏了所有其他的皮毛。我尝试在我的.es
我正在使用Firebase Cloud Functions托管我的SSR Nextjs应用程序。我可以在firebase云函数上部署Nextjs应用程序,并在没有React Hooks的情况下通过干净的URL访问它,但使用React Hooks时,我会收到一条错误消息:
Invariant Violation: Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
1.
制作一个视频游戏剪辑发布应用程序。我有一个控制器在后端,这将给我的剪辑的顺序,大多数评论剪辑到最少。我希望在数据正常排序之间进行切换,通过使用select标记(稍后我将添加更多过滤器)从大多数到最少的注释。我希望能够根据select标记onChange中的状态有条件地呈现这两个获取,但是我得到了一个错误。
Line 18:5: React Hook "useEffect" is called conditionally. React Hooks must be called in the exact same order in every component render
我正在尝试使用jest.spyOn()代替jest.mock进行测试,因为mock的返回值不能进行类型检查。但是,当我使用它时,我得到以下错误:
TypeError: Cannot set property useGame of #<Object> which has only a getter
> 3 | const STATE_SPY = jest.spyOn(hooks, "useGame");
| ^
at ModuleMockerClass.spyOn (node_modules/jest-mo
我的react应用程序在浏览器中显示以下错误
Failed to compile
./src/pages/home.js
Line 24:30: React Hook "useQuery" is called in function "home" which is neither a React function component or a custom React Hook function react-hooks/rules-of-hooks
错误:
React Hook "useState" is called in function "createFlight" that is
neither a React function component nor a custom React Hook function.
React component names must start with an uppercase letter react-
hooks/rules-of-hooks
我的代码:
import React, {Component} from 'react'
import {useState} from 'react'
const nav = () => {
const [activeNav, setActiveNav] = useState('#')
}
我想建个导航吧。我搞错了,我不知道为什么
React Hook "useState" is called in function "nav" that is neither a React function component nor a custom React Hook function. React compone
当我在后台收到通知时,我尝试用apollo-hooks和react-native-firebase从服务器获取数据。
我创建了新的函数和registerHeadlessTask。
但它发生在Hooks can only be called inside the body of a function component.上
react-native: 0.59.8 react-native-firebase: 5.5.6 react-apollo-hooks: 0.4.5
我尝试使用react-apollo-hooks获取数据,但出现错误。而且,我得到了另一个上下文的自定义钩子,它也发生了Hoo
我正在测试如何使用上下文在反应,但由于某些原因,我不能运行的应用程序,因为我的打字错误,我得到!
代码:
import React from 'react';
import './App.css';
class App extends React.Component {
render() {
return <Toolbar theme="dark" />;
}
}
function Toolbar(props) {
// The Toolbar component must take
尝试调用useEffect钩子内的redux操作创建器时出现以下警告- React Hook useEffect has a missing dependency: 'getPlanQuotes'. Either include it or remove the dependency array react-hooks/exhaustive-deps 这是useEffect钩子- const { getPlanQuotes } = props;
useEffect(() => {
getPlanQuotes();
}, []); 所以我试着用// eslint