我已经开始学习react-native而我正在尝试创建一个组件但是,当我看到代码时出现错误。有人知道为什么这个组件不起作用?
您需要像这样从'react'包中导入Component
import React, { Component } from 'react'
或者,您可以使用已导入的React类中的Component,就像这样
class MeuComponente extends React.Component {
// your code here
}
两种解决方案都是等价
你需要使用已导入的React类中的Component
,如下所示:Component
for React.Component