This commit is contained in:
Tommy Parnell
2018-11-02 22:50:24 -04:00
parent c3388ce241
commit c9a6da3eb7
3 changed files with 17 additions and 8 deletions

View File

@@ -4,6 +4,7 @@
"private": true, "private": true,
"dependencies": { "dependencies": {
"immutable": "^4.0.0-rc.12", "immutable": "^4.0.0-rc.12",
"moment": "^2.22.2",
"react": "^16.5.1", "react": "^16.5.1",
"react-dom": "^16.5.1", "react-dom": "^16.5.1",
"react-redux": "^5.0.7", "react-redux": "^5.0.7",

View File

@@ -1,15 +1,18 @@
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { incrementCount } from '../actions/counter.js';
import HelloWorld from '../components/HelloWorld' import HelloWorld from '../components/HelloWorld'
export const mapStateToProps = (state) => ({ import * as moment from 'moment';
clicks: state.get('counter') || 0
});
export const mapDispatchToProps = dispatch => ({
incrementClick: ()=>dispatch(incrementCount()) export const mapStateToProps = (state) => {
}) let daysUntilBirthday = moment
.duration(moment('2020-01-01')
.diff(moment()))
.days()
return {
message: `${state.get('message')} - You have ${daysUntilBirthday} days until your birthday!`
}
}
export default connect( export default connect(
mapStateToProps, mapStateToProps,
mapDispatchToProps,
)(HelloWorld); )(HelloWorld);

View File

@@ -4450,6 +4450,11 @@ mkdirp@0.5.1, mkdirp@0.5.x, mkdirp@^0.5.0, mkdirp@^0.5.1, mkdirp@~0.5.0, mkdirp@
dependencies: dependencies:
minimist "0.0.8" minimist "0.0.8"
moment@^2.22.2:
version "2.22.2"
resolved "https://registry.yarnpkg.com/moment/-/moment-2.22.2.tgz#3c257f9839fc0e93ff53149632239eb90783ff66"
integrity sha1-PCV/mDn8DpP/UxSWMiOeuQeD/2Y=
ms@2.0.0: ms@2.0.0:
version "2.0.0" version "2.0.0"
resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8" resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8"