javascript - Error using library: Invalid hook call. Hooks can only be called inside of the body of a function component
问题描述
I'm trying to use this library: https://github.com/adarshpastakia/ant-extensions/tree/master/modules/searchbar
I'm testing it on a codesandbox and it should work, but I get this error: **Invalid hook call. Hooks can only be called inside of the body of a function component. **
My code
import "./styles.css";
import { SearchBar } from "@ant-extensions/searchbar";
export default function App() {
return (
<div className="App">
<h1>Hello</h1>
<SearchBar
collapsed={false}
filters={[]}
fields={[]}
emptyField={"Message when fields list is empty"}
/>
</div>
);
}
Sandbox link: https://codesandbox.io/s/pedantic-snowflake-7c3mz?file=/src/App.js
解决方案
推荐阅读
- graphql - React Apollo GraphQL Mutation 返回 400(错误请求)
- css - 如何滚动flex-grow-1的flex行的内容
- python - 数据未显示在表格中
- android - 无法找到 DialogFragment 中的 NavController
- typescript - 在 Typescript 和 GraphQL 中删除用户后有消息
- ansible - Ansible 在提交之前预测条目是否会更改
- c++ - (.text+0x20): undefined reference to `main' 是什么意思
- c++ - C++14 及更高版本是否允许 Lambda 函数的默认参数?如果有怎么办?
- python - 删除数据框中具有重复值的行
- python - 如何动态创建新列表并将数据存储到其中