Every story and comment from the Hacker News API, in a layout borrowed from 2001.
A comment on Build Yourself a Redux. Parent comment
Start with
actionNames.txt
ADD_TODO REMOVE_TODO
<line> to:
export const <line> = "<line>"
export const (camelcase-string <line>) = () => { return { type: types.<line>, }; };
import * as actions from './actions'; import * as types from './actionTypes'; dispatch(actions.addTodo(...));
There are no comments on this comment yet.
Start with
actionNames.txt
Cat that file to actionTypes.js and actions.js. In actionTypes.js, expand:<line> to:
And in actions.js, expand <line> to something like: Also instead of importing actions and actionTypes individually, I'll generally do: