--- id: 5a24c314108439a4d4036171 title: Render State in the User Interface challengeType: 6 isRequired: false videoUrl: '' localeTitle: تقديم الدولة في واجهة المستخدم --- ## Description undefined ## Instructions undefined ## Tests
```yml tests: - text: '' testString: 'assert(Enzyme.mount(React.createElement(MyComponent)).state("name") === "freeCodeCamp", "MyComponent should have a key name with value freeCodeCamp stored in its state.");' - text: '' testString: 'assert(/

.*<\/h1><\/div>/.test(Enzyme.mount(React.createElement(MyComponent)).html()), "MyComponent should render an h1 header enclosed in a single div.");' - text: '' testString: 'async () => { const waitForIt = (fn) => new Promise((resolve, reject) => setTimeout(() => resolve(fn()), 250)); const mockedComponent = Enzyme.mount(React.createElement(MyComponent)); const first = () => { mockedComponent.setState({ name: "TestName" }); return waitForIt(() => mockedComponent.html()) }; const firstValue = await first(); assert(firstValue === "

TestName

", "The rendered h1 header should contain text rendered from the component's state.");};' ```

## Challenge Seed
```jsx class MyComponent extends React.Component { constructor(props) { super(props); this.state = { name: 'freeCodeCamp' } } render() { return (
{ /* change code below this line */ } { /* change code above this line */ }
); } }; ```
### After Test
```js console.info('after the test'); ```
## Solution
```js // solution required ```