DEV Community

Discussion on: Introduction to React

Collapse
 
aurelkurtula profile image
aurel kurtula

Thanks for the suggestion.

Just so that we are on the same page, you are talking about something like this right?

class App extends Component {
  state = { title: 'something' }
  myClick=()=>{
    this.setState({title: 'Title changed'})
  }
  render() {
    return (
      <div className="wrap">
        <h2>{this.state.title}</h2>
        <button onClick={this.myClick}>clickme</button>
      </div>
    )
  }
}

It does work and I like it.

Thanks again

Collapse
 
olivermensahdev profile image
Oliver Mensah

Welcome.