函数组件( Prop 、上下文、更新器){
236 | this.props = props; 237 | this.context = context; 238 | this.refs = emptyObject; 239 | // We initialize the default updater but the real one gets injected by the
名称.js
| import React,{Component}from 'react';
2 |
> 3 | class Name extends Component(){
4 | render(){
5 | return(
6 | <div> hello world</div>`
最佳答案
你那里有一些错别字。尝试删除 Component
之后的括号,如下所示:
class Name extends Component {
// ...
}
关于javascript - × 类型错误 : Cannot set property 'props' of undefined,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51233386/