Practice
class User extends React.Component {
constructor(props) {
super(props)
this.state = {
message: 'Welcome to React world'
}
}
render() {
return (
{this.state.message}
)
}
}
State is similar to props, but it is private and fully controlled by the component. That is, it is not accessible to any component other than the one that owns and sets it.

Comments