--- id: 5a24c314108439a4d403617c title: Use the Lifecycle Method componentWillMount challengeType: 6 isRequired: false videoUrl: '' localeTitle: '' --- ## Description undefined ## Instructions undefined ## Tests
```yml tests: - text: '' testString: 'assert((function() { const mockedComponent = Enzyme.mount(React.createElement(MyComponent)); return mockedComponent.find("div").length === 1; })(), "MyComponent should render a div element.");' - text: '' testString: 'assert((function() { const lifecycle = React.createElement(MyComponent).type.prototype.componentWillMount.toString().replace(/ /g,""); return lifecycle.includes("console.log("); })(), "console.log should be called in componentWillMount.");' ```
## Challenge Seed
```jsx class MyComponent extends React.Component { constructor(props) { super(props); } componentWillMount() { // change code below this line // change code above this line } render() { return
} }; ```
### After Test
```js console.info('after the test'); ```
## Solution
```js // solution required ```