This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { getPeople } from '../actions'; | |
const INITIAL_STATE = { | |
hasLoadedPeople: false, | |
errorGettingPeople: false, | |
list: [], | |
}; | |
const people = (state = INITIAL_STATE, { type, payload }) => { | |
switch (type) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { createRoutine } from 'redux-saga-routines'; | |
export const GET_PEOPLE = 'GET_PEOPLE'; | |
export const getPeople = createRoutine(GET_PEOPLE); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { connect } from 'react-redux'; | |
import PeopleList, { mapStateToProps, mapDispatchToProps } from './PeopleList'; | |
export default connect( | |
mapStateToProps, | |
mapDispatchToProps, | |
)(PeopleList); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component } from 'react'; | |
import Loading from 'react-loading'; | |
import { | |
shape, arrayOf, string, func, bool, number, | |
} from 'prop-types'; | |
import './PeopleList.css'; | |
import Panel from '../Panel'; | |
import { getPeople } from '../../actions'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import moment from 'moment'; | |
// Last day of tax year: 5th April 2018 | |
const lastDayOfTaxYear = moment([2018, 4, 5]); | |
// My birthday: 18th September 2018 | |
const myBirthday = moment([2018, 9, 18]); | |
const daysDiff = myBirthday.diff(lastDayOfTaxYear, 'days'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import differenceInDays from 'date-fns/difference_in_days' | |
// Last day of tax year: 5th April 2018 | |
const lastDayOfTaxYear = new Date(2018, 4, 5, 0, 0); | |
// My birthday: 18th September 2018 | |
const myBirthday = new Date(2018, 9, 18, 0, 0); | |
const daysDiff = differenceInDays(myBirthday, lastDayOfTaxYear); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
"bin": { | |
"mason": "src/mason.js" | |
}, | |
... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env node | |
const mason = require('commander'); | |
const { version } = require('./package.json'); | |
const console = require('console'); | |
// commands | |
const create = require('./commands/create'); | |
const setup = require('./commands/setup'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const batman = {firstName: 'Bruce', lastName: 'Wayne'}; | |
const superman = {firstName: 'Clark', lastName: 'Kent'}; | |
function speak(quote, location) { | |
console.log(this); | |
console.log(this.firstName + ' ' + this.lastName + ' ' + 'says ' + quote + ' from ' + location); | |
}; | |
// Apply for Array | |
speak.apply(batman, ["'It's not who I am underneath, but what I do that defines me'", "Gotham City"]); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* | |
* Incorrect Context | |
* | |
*/ | |
class Greeter { | |
constructor(name) { | |
this.name = name; | |
} |