I am trying to change colour of text in h1 tag when I click button. I am calling change colour function but when onclick it executes at that time it is showing error in the inside statement [ this.styling_text.color="black" ]
import React,{Component} from 'react';class InlineDynamic extends Component{ changeColor = () =>{ this.styling_text.color="black" }; render(){ const styling_text = {color:"red"}; return(<div><h1 style={styling_text} >Change My Colour !! on click</h1><button onClick={this.changeColor}>click me</button></div> ); }}export default InlineDynamic;