今天做项目遇到了一个坑

import React, { Component,PropTypes} from 'react';

console.log(PropTypes);        //undefined

用来限制prop的propTypes竟然是undefined,后查了资料才知道这种写法已经被废除,现在的写法如下:

import React, { Component } from 'react';
import PropTypes from 'prop-types';

 

相关文章:

  • 2021-06-09
  • 2021-12-25
  • 2022-01-19
  • 2022-12-23
  • 2021-10-29
  • 2022-12-23
  • 2021-06-01
  • 2021-08-04
猜你喜欢
  • 2021-12-29
  • 2021-11-18
  • 2022-12-23
  • 2021-11-16
  • 2022-12-23
  • 2021-06-09
  • 2022-12-23
相关资源
相似解决方案