This file contains 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 reswitch from 'reswitch' | |
import {USERS_GET, USERS_GET__SUCCESS, USERS_GET__FAILURE} from 'consts/users' | |
const INITIAL_STATE = {areLoading: false, hasError: false, users: null} | |
const users(state = INITIAL_STATE, action) => reswitch( | |
USERS_GET, | |
{...defaultState, areLoading: true}, | |
USERS_GET__SUCCESS, |
This file contains 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 todos = (state = INITIAL_STATE, action) => reswitch( | |
ADD_TODO, | |
[...state.todos, action.todo], | |
REMOVE_TODO, | |
() => state.todos.filter(todo => todo.id !== action.todo.id) | |
)(state, action.type) |
This file contains 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 todos = (state = INITIAL_STATE, action) => { | |
switch (action.type) { | |
case ADD_TODO: | |
return [...state.todos, action.todo] | |
case REMOVE_TODO: | |
return state.todos.filter(todo => todo.id !== action.todo.id) | |
default: | |
return state | |
} | |
} |
This file contains 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 from 'react' | |
class Lightbox extends Component { | |
constructor () { | |
super() | |
this.prev = this.prev.bind(this) | |
this.next = this.next.bind(this) | |
} |
This file contains 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 from 'react' | |
const IMAGES = [1, 2, 3] | |
const Lightbox = ({imageUrl, onPrev, onNext}) => ( | |
return ( | |
<div> | |
<button onClick={onPrev}>Previous</button> | |
<img src={imageUrl} /> |
This file contains 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 from 'react' | |
const Dropdown = ({onClickRegisterButton}) => ( | |
<ul> | |
<li>One</li> | |
<li onClick={onClickRegisterButton}>Two</li> | |
<li>Three</li> | |
</ul> | |
) |
This file contains 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 {Header, Sidebar, Body, Content, Footer} from './containers' | |
import Modal from '../components/Modal' | |
class Home extends Component { | |
constructor () { | |
super() | |
this.openModal = this.openModal.bind(this) |
This file contains 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
<Home> | |
<Header /> | |
<Body> | |
<Sidebar /> | |
<Content /> | |
</Body> | |
<Footer /> | |
</Home> |
NewerOlder