错误:
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
我基于变量加载呈现两个Chakra UI组件:
{loading ? (<Spinner>) : (<Text color={useColorModeValue('gray.800', 'gray.400')>Hi</Text) }
但是IDE警告我这一点:ESLint: React Hook "useColorModeValue" is called conditionally. React Hooks must be called in the exact same order in every componen
我的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
我正在使用create-react-library来构建我的组件库,并且我尝试使用样式化的组件,但是我一直收到一个React钩子错误。 下面是我的代码:https://github.com/emmabostian/component-library 下面是错误: Error: 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. You might have mi
我试图在我的功能组件中使用React useState钩子,但是我得到了这个错误:
Failed to compile
./src/Person/Person.js
Line 5:43: React Hook "useState" is called in function "person" which is neither a React function component or a custom React Hook function react-hooks/rules-of-hooks
Search for the keywords to le
当我在另一个项目中使用相同的方法时,它运行得很好,但是我决定对我当前的项目使用相同的方法,然后我对下面给出的内容有了一个问题。
react-dom.development.js:14724 Uncaught Error: 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. You might have mismatching versions of React a