Réponse
get name(){return "whatever_name"}
Colonne
Explication
The getter method to your class body should have a name of name, and a return value of a string. exemple : import React from 'react';
import ReactDOM from 'react-dom';
class MyName extends React.Component {
// name property goes here:
get name(){
return 'whatever-your-name-is-goes-here';
}
render() {
return <h1>My name is {this.name}.</h1>;
}
}
ReactDOM.render(<MyName />, document.getElementById('app'));
Question
Syntaxe du getter de ma classe MyName (qui retourne pour l'exemple la chaîne "whatever_name"
Thématique