| Total Complexity | 1 |
| Complexity/F | 1 |
| Lines of Code | 19 |
| Function Count | 1 |
| Duplicated Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | import { connect } from 'react-redux' |
||
| 2 | import { getPostTitle, getEditedTitle } from 'post/state/selectors' |
||
| 3 | import { editPostTitle } from 'post/state/actions' |
||
| 4 | import Title from 'post/components/Title' |
||
| 5 | |||
| 6 | const mapStateToProps = state => { |
||
| 7 | const editedTitle = getEditedTitle(state) |
||
| 8 | const title = getPostTitle(state) |
||
| 9 | return { |
||
| 10 | title: editedTitle || '', |
||
| 11 | isEdited: editedTitle !== title |
||
| 12 | } |
||
| 13 | } |
||
| 14 | |||
| 15 | const mapDispatchToProps = { |
||
| 16 | editPostTitle |
||
| 17 | } |
||
| 18 | |||
| 19 | export default connect(mapStateToProps, mapDispatchToProps)(Title) |
||
| 20 |