mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-03-02 20:02:00 -05:00
857 B
857 B
title, localeTitle
| title | localeTitle |
|---|---|
| Create a Stateful Component | إنشاء مكون Stateful |
إنشاء مكون Stateful
تلميح 1:
class StatefulComponent extends React.Component {
constructor(props) {
super(props);
// initialize state here
// "This" area may be a good place to use "dot" notation.
// dont forget to describe "name" property inside the state and assign your name to a property of "name".
}
render() {
return (
<div>
<h1>{this.state.name}</h1>
</div>
);
}
};
حل
`class StatefulComponent extends React.Component { constructor(props) { super(props); // initialize state here
this.state = {
name : "Name"
}
} render() { return (