Skip to content

Instantly share code, notes, and snippets.

View TapaniAla's full-sized avatar

TapaniA TapaniAla

  • TaalVision Technologies Oy
  • Oulu, Finland
View GitHub Profile
@TapaniAla
TapaniAla / Redux 20: extracting presen tational component(todo, todolist)
Last active June 8, 2017 05:12 — forked from anonymous/index.html
Redux 20: extracting presen tational component(todo, todolist)
<div id="root"></div>
@TapaniAla
TapaniAla / Redux 19: react todo list example (filtering a todo)
Created June 2, 2017 07:50 — forked from anonymous/index.html
Redux 19: react todo list example (filtering a todo)
<div id="root"></div>
@TapaniAla
TapaniAla / Redux 18: react todo list example (toggling a todo)
Last active June 8, 2017 05:14 — forked from anonymous/index.html
Redux 18: react todo list example (toggling a todo)
<div id="root"></div>
@TapaniAla
TapaniAla / Redux 17: react todo list example
Last active June 2, 2017 06:46 — forked from anonymous/index.html
Redux 17: react todo list example
<div id="root"></div>
@TapaniAla
TapaniAla / Redux 16: Implementing combineReducers() from Scratch
Last active June 8, 2017 05:11 — forked from anonymous/ngklqr.markdown
Redux 16: Implementing combineReducers() from Scratch
NgKLqr
------
A [Pen](https://codepen.io/TapaniA/pen/NgKLqr) by [Tapani Alakiuttu](http://codepen.io/TapaniA) on [CodePen](http://codepen.io/).
[License](https://codepen.io/TapaniA/pen/NgKLqr/license).
const todo = (state, action) => {
switch (action.type) {
case 'ADD_TODO':
return {
id: action.id,
text: action.text,
completed: false
};
case 'TOGGLE_TODO':
if(state.id !== action.id) {
const todo = (state, action) => {
switch (action.type) {
case 'ADD_TODO':
return {
id: action.id,
text: action.text,
completed: false
};
case 'TOGGLE_TODO':
if(state.id !== action.id) {
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<script src="https://wzrd.in/standalone/expect@latest"></script>
<script src="https://wzrd.in/standalone/deep-freeze@latest"></script>
</head>
<body>
const todos = (state=[], action) => {
switch (action.type) {
case 'ADD_TODO':
return [
...state,
{id: action.id,
text: action.text,
completed: false
}
];
const todos = (state=[], action) => {
switch (action.type) {
case 'ADD_TODO':
return [
...state,
{id: action.id,
text: action.text,
completed: false
}
];