super got strikethrough in React

后端 未结 4 712
挽巷
挽巷 2021-01-18 23:52

Code

import React, { Component } from \'react\';
import PropTypes from \'prop-types\';
import axios from \'axios\';
import { connect } from \'react-redux\';         


        
4条回答
  •  情歌与酒
    2021-01-19 00:45

    I think it may has to do with ES 6 syntax for React. Now you don't have to use the constructor nor the super in React.

    For example, you can write

    export default class ExpenseForm extends React.Component {
        state ={
            description:'',
            amount:''
        }
    }
    

    VS Code may detect the unnecessary use of constructor and super that is crossed out.

提交回复
热议问题