Files
Randell Dawson 1494a50123 fix(guide): restructure curriculum guide articles (#36501)
* fix: restructure certifications guide articles
* fix: added 3 dashes line before prob expl
* fix: added 3 dashes line before hints
* fix: added 3 dashes line before solutions
2019-07-24 13:29:27 +05:30

64 lines
1.2 KiB
Markdown

---
title: Render State in the User Interface Another Way
---
# Render State in the User Interface Another Way
---
## Hints
### Hint 1
```JSX
class MyComponent extends React.Component {
constructor(props) {
super(props);
this.state = {
name: 'freeCodeCamp'
}
}
render() {
// change code below this line
// Remember that how you can access the property of a state.
// change code above this line
return (
<div>
{ /* change code below this line */ }
// Just use the const "name" inside the h1 tag.
// Dont forget to use JSX syntax "{ curly braces for JavaScript }".
{ /* change code above this line */ }
</div>
);
}
};
```
---
## Solutions
<details><summary>Solution 1 (Click to Show/Hide)</summary>
```JSX
class MyComponent extends React.Component {
constructor(props) {
super(props);
this.state = {
name: 'freeCodeCamp'
}
}
render() {
// change code below this line
const name = this.state.name;
// change code above this line
return (
<div>
{ /* change code below this line */ }
<h1>{name}</h1>
{ /* change code above this line */ }
</div>
);
}
};
```
</details>