问题描述
报'propTypes' is not defined no-undef 错误
问题出现的环境背景及自己尝试过哪些方法
安装了propTypes,也引入了,但是不知道为什么报这个错
相关代码
// 请把代码文本粘贴到下方(请勿用图片代替代码)
import React from 'react';
import { HashRouter as Router, Route, Switch, Redirect } from 'react-router-dom';
import { hashHistory } from 'react-router';
import NotFound from './components/pages/NotFound';
import App from './App';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import {initMenu} from './store/index/action'
class Page extends React.Component {
static propTypes = {
initMenu: PropTypes.func
}
constructor(props){
super(props);
this.state={
path: '/app/realtime/survey'
}
}
在Page类外面写