Use esto en un componente React JS
class MyName extends React.Component {
// name property goes here:
get name() {
return 'Anthony';
}
render() {
return <h1>My name is {this.name}.</h1>;
}
}
ReactDOM.render(<MyName />, document.getElementById('app'));
Anthony Smith