Cannot resolve symbol ‘Component’ & Cannot resolve symbol ‘PropTypes’

Posted 东风杨柳岸,岁月如烟

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Cannot resolve symbol ‘Component’ & Cannot resolve symbol ‘PropTypes’相关的知识,希望对你有一定的参考价值。

import React, { Component, PropTypes } from ‘react‘ 

  报错:Cannot resolve symbol ‘Component‘ 
       Cannot resolve symbol ‘PropTypes‘

1.解决 Cannot resolve symbol ‘Component‘ 

  安装依赖:npm install @types/react --save
  调用方法:import React, { Component } from ‘react‘

2.解决 Cannot resolve symbol ‘PropTypes‘

  安装依赖:npm install prop-types --save
  调用方法:import PropTypes from ‘prop-types‘

注:React.PropTypes 自 React v15.5 起已弃用。请使用 prop-types 库代替。

以上是关于Cannot resolve symbol ‘Component’ & Cannot resolve symbol ‘PropTypes’的主要内容,如果未能解决你的问题,请参考以下文章

Java 报错cannot resolve symbol String Utils怎么解决?

Cannot resolve symbol ‘c:forEach‘;

Cannot resolve symbol 'SpringBootApp

cannot resolve symbol AppCompatActivity 心得

Reshaper cannot resolve symbol

IntelliJ IDEA提示Cannot resolve symbol