gpt4 book ai didi

javascript - × 类型错误 : Cannot set property 'props' of undefined

转载 作者:行者123 更新时间:2023-12-01 01:53:30 26 4
gpt4 key购买 nike

函数组件( 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/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com