What's the difference between writing react's state on constructor and writing on the class attribute?

class Test extends Component {
  state = {
    count:1
  }
  constructor(props){
    super(props)
    this.state = {
      count:1
    }
  }
  onClickFn = () => {
    this.setState({
      count:this.state.count+1
    })
  }
  render(){
    return (<div onClick={this.onClickFn}>{this.state.count}</div>)
  }


        <Test />
        <Test />
        <Test />

there should be static properties above and instance properties below, but I don"t feel any different. Who will elaborate on
Writing multiple static attributes without sharing

Mar.31,2021

if it's just a value, of course you can

if you want to set the value and display it, you need the following state


clipboard.png
compare the output of babel, there is no difference at all

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e461af-44b82.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e461af-44b82.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?