|
20 | 20 | ],
|
21 | 21 | "actions": [
|
22 | 22 | "open('package.json')",
|
23 |
| - "set('{\n \"name\": \"coderoad-redux-js-demo\",\n \"version\": \"0.1.0\",\n \"description\": \"Coderoad tutorial for using redux with raw javascript\",\n \"bugs\": {\n \"url\": \"https://github.com/shmck/coderoad-redux-js\"\n },\n \"license\": \"ISC\",\n \"author\": \"Shawn McKay <shawn.j.mckay@gmail.com>\",\n \"main\": \"index.js\",\n \"repository\": \"https://github.com/shmck/coderoad-redux-js\",\n \"scripts\": {\n \"test\": \"echo \\\"Error: no test specified\\\" && exit 1\"\n },\n \"dependencies\": {\n \"mocha-coderoad\": \"0.9.3\",\n \"coderoad-redux-js\": \"0.1.0\"\n },\n \"devDependencies\": {\n \"babel-preset-es2015\": \"^6.9.0\",\n \"babel-preset-react\": \"^6.11.1\",\n \"babelify\": \"^7.3.0\",\n \"browser-sync\": \"^2.13.0\",\n \"concurrently\": \"^2.2.0\",\n \"npm-watch\": \"^0.1.5\",\n \"coderoad-redux-js\": \"^0.1.0\"\n },\n \"watch\": {\n \"reload\": {\n \"patterns\": [\n \"src\"\n ],\n \"extensions\": \"js,jsx,css,html,scss\",\n \"ignore\": \"node_modules\",\n \"quiet\": false\n }\n },\n \"scripts\": {\n \"browserify\": \"browserify src/index.js --extension=.jsx -o dist/bundle.js -t [ babelify --presets [ es2015 react ] ]\",\n \"browsersync:reload\": \"browser-sync reload\",\n \"browsersync:start\": \"browser-sync start --server --files 'index.html dist/bundle.js'\",\n \"build\": \"npm run browserify\",\n \"reload\": \"npm run browserify && npm run browsersync:reload\",\n \"start\": \"concurrently --kill-others 'npm run build' 'npm run browsersync:start' 'npm run watch'\",\n \"test\": \"echo \\\"Error: no test specified\\\" && exit 1\",\n \"watch\": \"npm-watch\",\n \"setup\": \"npm i && mkdir -p dist && mkdir -p src && touch src/index.js && npm i -g concurrently browser-sync \"\n }\n}\n')" |
| 23 | + "set('{\n \"name\": \"coderoad-redux-js-demo\",\n \"version\": \"0.1.0\",\n \"description\": \"Coderoad tutorial for using redux with raw javascript\",\n \"bugs\": {\n \"url\": \"https://github.com/shmck/coderoad-redux-js\"\n },\n \"license\": \"ISC\",\n \"author\": \"Shawn McKay <shawn.j.mckay@gmail.com>\",\n \"main\": \"index.js\",\n \"repository\": \"https://github.com/shmck/coderoad-redux-js\",\n \"scripts\": {\n \"test\": \"echo \\\"Error: no test specified\\\" && exit 1\"\n },\n \"dependencies\": {\n \"mocha-coderoad\": \"0.9.3\"\n },\n \"devDependencies\": {\n \"babel-preset-es2015\": \"^6.9.0\",\n \"babel-preset-react\": \"^6.11.1\",\n \"babelify\": \"^7.3.0\",\n \"browser-sync\": \"^2.13.0\",\n \"concurrently\": \"^2.2.0\",\n \"npm-watch\": \"^0.1.5\",\n \"coderoad-redux-js\": \"^0.1.0\"\n },\n \"watch\": {\n \"reload\": {\n \"patterns\": [\n \"src\"\n ],\n \"extensions\": \"js,jsx,css,html,scss\",\n \"ignore\": \"node_modules\",\n \"quiet\": false\n }\n },\n \"scripts\": {\n \"browserify\": \"browserify src/index.js --extension=.jsx -o dist/bundle.js -t [ babelify --presets [ es2015 react ] ]\",\n \"browsersync:reload\": \"browser-sync reload\",\n \"browsersync:start\": \"browser-sync start --server --files 'index.html dist/bundle.js'\",\n \"build\": \"npm run browserify\",\n \"reload\": \"npm run browserify && npm run browsersync:reload\",\n \"start\": \"concurrently --kill-others 'npm run build' 'npm run browsersync:start' 'npm run watch'\",\n \"test\": \"echo \\\"Error: no test specified\\\" && exit 1\",\n \"watch\": \"npm-watch\",\n \"setup\": \"npm i && mkdir -p dist && mkdir -p src && touch src/index.js && npm i -g concurrently browser-sync \"\n }\n}\n')" |
24 | 24 | ]
|
25 | 25 | },
|
26 | 26 | {
|
|
30 | 30 | ],
|
31 | 31 | "actions": [
|
32 | 32 | "open('index.html')",
|
33 |
| -"set('<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n <meta charset=\"UTF-8\">\n <title>Worst Pokemon</title>\n <link\n rel=\"stylesheet\"\n href=\"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css\"\n crossorigin=\"anonymous\"\n />\n</head>\n<body>\n <div id=\"app\">\n <p>Check the console...</p>\n </div>\n\n <script src=\"dist/bundle.js\"></script>\n</body>\n</html>\n\n')" |
| 33 | +"set('<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n <meta charset=\"UTF-8\">\n <title>Worst Pokemon</title>\n <link\n rel=\"stylesheet\"\n href=\"https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css\"\n crossorigin=\"anonymous\"\n />\n</head>\n<body>\n <div id=\"app\">\n <h1>Welcome!</h1>\n <p>Check the console...</p>\n </div>\n\n <script src=\"dist/bundle.js\"></script>\n</body>\n</html>\n\n')" |
34 | 34 | ]
|
35 | 35 | }
|
36 | 36 | ],
|
|
110 | 110 | "description":"Events that change the data.\n\n##### 1. Actions\n```js\nconst action = { type: 'ACTION_NAME' };\n```\n\n##### 2. Action Creators\n\n```js\nconst actionName = () => ({ type: 'ACTION_NAME' });\n```\n\n##### 3. Action Types\n\n```js\nconst ACTION_NAME = 'ACTION_NAME'\n```",
|
111 | 111 | "tasks": [
|
112 | 112 | {
|
113 |
| -"description":"create an action called `voteUp`", |
| 113 | +"description":"create an action called `voteUp` and a type of 'VOTE_UP'", |
114 | 114 | "tests": [
|
115 | 115 | "03/01"
|
116 | 116 | ],
|
|
129 | 129 | ]
|
130 | 130 | },
|
131 | 131 | {
|
132 |
| -"description":"add a param of `id` to your action creator", |
| 132 | +"description":"add a param of `id` to your action creator, and a payload of\"id\"", |
133 | 133 | "tests": [
|
134 | 134 | "03/03"
|
135 | 135 | ]
|
|
161 | 161 | "description":"The data transformation\n\n```js\nconst reducer = (state) => {\n console.log(state);\n return state;\n};\n```",
|
162 | 162 | "tasks": [
|
163 | 163 | {
|
164 |
| -"description":"Extract the `state => state` functionin create store, andcall in a new function called\"reducer\".", |
| 164 | +"description":"Extract the `state => state` functioncalled by `createStore`, anddeclare it with a variable called\"reducer\".", |
165 | 165 | "tests": [
|
166 | 166 | "04/01"
|
167 | 167 | ],
|
168 | 168 | "actions": [
|
169 | 169 | "open('src/index.js')"
|
| 170 | + ], |
| 171 | +"hints": [ |
| 172 | +"Try this: `const reducer = state => state;`", |
| 173 | +"Rename this: `const store = createStore(reducer, initialState)`" |
170 | 174 | ]
|
171 | 175 | },
|
172 | 176 | {
|
|
180 | 184 | ]
|
181 | 185 | },
|
182 | 186 | {
|
183 |
| -"description":"Pass an action as a second param tothereducer", |
| 187 | +"description":"The reducer takes two params. The first is\"state\", callthesecond one\"action\"", |
184 | 188 | "tests": [
|
185 | 189 | "04/03"
|
| 190 | + ], |
| 191 | +"hints": [ |
| 192 | +"Try this: `const reducer = (state, action) => ...`" |
186 | 193 | ]
|
187 | 194 | },
|
188 | 195 | {
|
|
192 | 199 | ]
|
193 | 200 | },
|
194 | 201 | {
|
195 |
| -"description":"Create a `switch` statement and pass in `action.type`, the default return should return `state`", |
| 202 | +"description":"Create a `switch` statementin your `reducer`and pass in `action.type`, the default return should return `state`", |
196 | 203 | "tests": [
|
197 | 204 | "04/05"
|
| 205 | + ], |
| 206 | +"hints": [ |
| 207 | +"In your reducer, try this: `switch(action.type) {}`", |
| 208 | +"Your switch statement should have a `default: return state`" |
198 | 209 | ]
|
199 | 210 | },
|
200 | 211 | {
|
|
207 | 218 | "description":"add a switch case for `VOTE_UP`. For now, just console.log the `id` of the action passed in and return the default state again. Tip: destructuring: `const { id } = action.payload;`",
|
208 | 219 | "tests": [
|
209 | 220 | "04/07"
|
| 221 | + ], |
| 222 | +"hints": [ |
| 223 | +"Try this: `case VOTE_UP: console.log(action.payload.id);`" |
210 | 224 | ]
|
211 | 225 | }
|
212 | 226 | ],
|
|