Why is value in console log not showing in ReactJS

I have a react app where console.log not showing the values in it but it displays the message. eg,

class Sample extends Component {
  constructor() {
    super()
    this.handleSubmit = this.handleSubmit.bind(this);
        this.state = {
                         msg:"Hi"
                     }}
 handleSubmit(event) {
    console.log("Message",this.state.msg);
}


render() {

      return(
        <div >
        <RaisedButton label="Save" onClick={this.handleSubmit}/>
        </div>
      );
    }}

Not only state values but whatever values I gave its not displaying. What will be the issue be? Please help

1 answer

  • answered 2018-11-08 07:13 Subin T

    I got the answer. It was a small error, I gave

    console.log("Message" +this.state.msg);
    

    changed coma to plus.