How to initialize state? with data after fetching data

import React from "react";
class Demo extends React.Component{
  constructor(props){
    super(props)
    this.state{
      initData: ""
    }
  }

  render(){
      return(
        <div>{ this.state.initData }<div>
      )
  }
}
function mapStateToProps(state) {
  const { demoData } = state.demo;
  return { demoData };
}
export default connect(mapStateToProps)(Demo );

how do I initialize state with demoData? Several hook functions were used without success.

Mar.23,2021

initialize state. with demoData What do you mean?


componentWillReceiveProps (nextProps) {

if(nextProps.demoData  !== this.props.demoData){
    this.setData({
       initData: nextProps.demoData 
    })
}

}

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-1bf1e8c-31dad.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-1bf1e8c-31dad.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?