如何找到需要一组检查函数,但收到未定义
是否缺少 prop 类型定义?
如何在下面的列表中导航?请注意,大多数链接到我的代码都位于 export class ...
声明中。
谢谢
Warning: Invalid argument supplied to oneOfType. Expected an array of check functions, but received undefined at index 2.
console.<computed> @ index.js:1
printWarning @ warning.js:33
warning @ warning.js:57
createUnionTypeChecker @ factoryWithTypeCheckers.js:326
./node_modules/react-table/es/propTypes.js @ propTypes.js:85
__webpack_require__ @ bootstrap:785
fn @ bootstrap:150
./node_modules/react-table/es/index.js @ defaultProps.js:9
__webpack_require__ @ bootstrap:785
fn @ bootstrap:150
./src/views/TableList/TerminologyTable.jsx @ ProductRow.jsx:4
__webpack_require__ @ bootstrap:785
fn @ bootstrap:150
./src/routes/app.jsx @ app.jsx:1
__webpack_require__ @ bootstrap:785
fn @ bootstrap:150
./src/components/Header/HeaderLinks.jsx @ Header.jsx:8
__webpack_require__ @ bootstrap:785
fn @ bootstrap:150
./src/components/Header/Header.jsx @ GraphCard.jsx:53
__webpack_require__ @ bootstrap:785
fn @ bootstrap:150
./src/containers/App/App.jsx @ UserCard.jsx:35
__webpack_require__ @ bootstrap:785
fn @ bootstrap:150
./src/index.js @ spinner.gif:1
__webpack_require__ @ bootstrap:785
fn @ bootstrap:150
1 @ UserProfile.jsx:16
__webpack_require__ @ bootstrap:785
checkDeferredModules @ bootstrap:45
webpackJsonpCallback @ bootstrap:32
(anonymous) @ main.chunk.js:1
编辑============
下面是示例代码,引用上面列表末尾的 @ UserProfile.jsx:16
。
import React from 'react';
import {
Grid, Row, Col,
FormGroup, ControlLabel, FormControl
} from 'react-bootstrap';
import {Card} from 'components/Card/Card.jsx';
import {FormInputs} from 'components/FormInputs/FormInputs.jsx';
import {UserCard} from 'components/UserCard/UserCard.jsx';
import Button from 'elements/CustomButton/CustomButton.jsx';
import { ProjectName, ProjectSlogan } from 'variables/Config';
//
//
/* line 16 */ export class UserProfile extends React.PureComponent {
render() {
// console.log("userprofile", this.props)
const {mbouser} = this.props
return (
<div className="content">xxxxxxx
</div>
);
}
}
最佳答案
就我而言,我只是更改了这些
import PropTypes from 'prop-types';
export default function useGetAdvertising({
option = PropTypes.string = ""
}) {
...
}
至
export default function useGetAdvertising({
option = ""
}) {
...
}
useGetAdvertising.propTypes = {
option: PropTypes.string,
};
useGetAdvertising.defaultProps = {
option: "",
}
关于javascript - 如何解决 React 警告 : Invalid argument supplied to oneOfType. 需要一个检查函数数组,但在索引 2 处收到未定义。?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60650934/