2018-10-12 15:37:13 -04:00
|
|
|
---
|
|
|
|
title: Map State to Props
|
|
|
|
---
|
|
|
|
## Map State to Props
|
|
|
|
|
2019-05-09 06:27:06 -07:00
|
|
|
### Solution
|
|
|
|
<details>
|
|
|
|
<summary>Spoiler!</summary>
|
2018-10-12 15:37:13 -04:00
|
|
|
|
2019-05-09 06:27:06 -07:00
|
|
|
```jsx
|
|
|
|
const state = [];
|
2018-10-12 15:37:13 -04:00
|
|
|
|
2019-05-09 06:27:06 -07:00
|
|
|
// change code below this line
|
|
|
|
const mapStateToProps = (state)=>{
|
|
|
|
return {
|
|
|
|
messages: state
|
|
|
|
}
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
</details>
|