I often see the following pattern used within JavaScript classes and React.
class Welcome extends React.Component {
state: {
someValue: 1
}
render() {
const myValue = this.state.someValue;
return <h1>Hello, {myValue}</h1>;
}
}
My question is, what is the point/benefit of declaring state to a variable before the return when you can access the value with this.state.someValue
within return anyway?