I'm wondering if there is any benefit (maintainability, rendering, performance etc.) to having a constant declared as a static class property vs just being a constant within the file.
Is there any difference or is this just personal preference?
The code is just to show a simple example, I understand in this instance you would just have the string in the render and probably use a stateless component instead of a class.
class MyClass extends React.Component {
static myText = "This is an example";
render() {
return <p>{MyClass.myText}</p>
}
}
vs
const myText = "This is an example";
class MyClass extends React.Component {
render() {
return <p>{myText}</p>
}
}