react cannot set property of props of undefined

前端 未结 1 893
忘了有多久
忘了有多久 2021-01-21 20:29

I have a simple component like this

import { Component } from \'react\'

export default class SearchList extends Component(){
    constructor(props){
        sup         


        
1条回答
  •  感情败类
    2021-01-21 21:04

    When you write a react component extending React.Component you don't need the extra () after React.Component

    Use this

    export default class SearchList extends Component{
        constructor(props){
            super(props);
        }
        render(){
            const { placeholder } = this.props;
            return(
                
    ) } }

    0 讨论(0)
提交回复
热议问题