From 02cfc33932df2b7681ed8e6fef7f48e27510c89e Mon Sep 17 00:00:00 2001 From: Nickzheng Date: Wed, 27 Jul 2016 13:58:00 +0800 Subject: [PATCH 01/19] Update 4-async-middleware.js FIX case FETCH_USERS_FULFILLED --- 4-redux/src/js/4-async-middleware.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/4-redux/src/js/4-async-middleware.js b/4-redux/src/js/4-async-middleware.js index 777caa1e..235eea33 100644 --- a/4-redux/src/js/4-async-middleware.js +++ b/4-redux/src/js/4-async-middleware.js @@ -21,7 +21,7 @@ const reducer = (state=initialState, action) => { return {...state, fetching: false, error: action.payload} break; } - case "FETCH_USERS_ FULFILLED": { + case "FETCH_USERS_FULFILLED": { return { ...state, fetching: false, From c187bd0b0df5795503fd341e8c2f8ca0e8f6921d Mon Sep 17 00:00:00 2001 From: Will Stern Date: Tue, 16 Aug 2016 21:14:19 -0500 Subject: [PATCH 02/19] add mobx --- 6-mobx-react/.babelrc | 4 +++ 6-mobx-react/.gitignore | 2 ++ 6-mobx-react/.nvmrc | 1 + 6-mobx-react/package.json | 30 +++++++++++++++++++ 6-mobx-react/src/css/main.css | 50 ++++++++++++++++++++++++++++++++ 6-mobx-react/src/index.html | 9 ++++++ 6-mobx-react/src/js/TodoList.js | 37 +++++++++++++++++++++++ 6-mobx-react/src/js/TodoStore.js | 34 ++++++++++++++++++++++ 6-mobx-react/src/js/main.js | 10 +++++++ 6-mobx-react/webpack.config.js | 28 ++++++++++++++++++ 10 files changed, 205 insertions(+) create mode 100644 6-mobx-react/.babelrc create mode 100644 6-mobx-react/.gitignore create mode 100644 6-mobx-react/.nvmrc create mode 100644 6-mobx-react/package.json create mode 100644 6-mobx-react/src/css/main.css create mode 100644 6-mobx-react/src/index.html create mode 100644 6-mobx-react/src/js/TodoList.js create mode 100644 6-mobx-react/src/js/TodoStore.js create mode 100644 6-mobx-react/src/js/main.js create mode 100644 6-mobx-react/webpack.config.js diff --git a/6-mobx-react/.babelrc b/6-mobx-react/.babelrc new file mode 100644 index 00000000..1957865a --- /dev/null +++ b/6-mobx-react/.babelrc @@ -0,0 +1,4 @@ +{ + "presets": ['react', 'es2015'], + "plugins": ['transform-decorators-legacy', 'transform-class-properties'] +} diff --git a/6-mobx-react/.gitignore b/6-mobx-react/.gitignore new file mode 100644 index 00000000..fd4f2b06 --- /dev/null +++ b/6-mobx-react/.gitignore @@ -0,0 +1,2 @@ +node_modules +.DS_Store diff --git a/6-mobx-react/.nvmrc b/6-mobx-react/.nvmrc new file mode 100644 index 00000000..dffc266d --- /dev/null +++ b/6-mobx-react/.nvmrc @@ -0,0 +1 @@ +v6.3.0 diff --git a/6-mobx-react/package.json b/6-mobx-react/package.json new file mode 100644 index 00000000..bbb08817 --- /dev/null +++ b/6-mobx-react/package.json @@ -0,0 +1,30 @@ +{ + "name": "react-mobx-todos", + "version": "1.0.0", + "description": "", + "main": "index.js", + "scripts": { + "start": "webpack-dev-server --content-base src --inline --hot" + }, + "keywords": [], + "author": "", + "license": "ISC", + "dependencies": { + "mobx": "^2.3.7", + "mobx-react": "^3.5.1", + "react": "^15.2.1", + "react-dom": "^15.3.0" + }, + "devDependencies": { + "babel-loader": "^6.2.4", + "babel-plugin-transform-class-properties": "^6.10.2", + "babel-plugin-transform-decorators-legacy": "^1.3.4", + "babel-preset-es2015": "^6.9.0", + "babel-preset-react": "^6.11.1", + "css-loader": "^0.23.1", + "react-addons-test-utils": "^15.3.0", + "style-loader": "^0.13.1", + "webpack": "^1.13.1", + "webpack-dev-server": "^1.14.1" + } +} diff --git a/6-mobx-react/src/css/main.css b/6-mobx-react/src/css/main.css new file mode 100644 index 00000000..8d6ed00c --- /dev/null +++ b/6-mobx-react/src/css/main.css @@ -0,0 +1,50 @@ +html, +body { + margin: 0; + padding: 0; +} + +body { + font-family: 'Slabo 27px', serif; + background: #f5f5f5; + color: #4d4d4d; + min-width: 230px; + max-width: 550px; + margin: 0 auto; + -webkit-font-smoothing: antialiased; + -moz-font-smoothing: antialiased; + font-smoothing: antialiased; + font-weight: 300; +} + +input { + border-radius: 5px; + padding: 5px; + border: 1px solid rgba(0,0,0,0.3); + margin-right: 10px +} + +input::-webkit-input-placeholder { + font-style: italic; + font-weight: 300; + color: rgba(0,0,0,0.3); +} + +input::-moz-placeholder { + font-style: italic; + font-weight: 300; + color: rgba(0,0,0,0.3); +} + +input::input-placeholder { + font-style: italic; + font-weight: 300; + color: rgba(0,0,0,0.3); +} + +h1 { + font-weight: 100; + font-size: 100px; + padding:0; + margin: 0; +} diff --git a/6-mobx-react/src/index.html b/6-mobx-react/src/index.html new file mode 100644 index 00000000..a9e74ecd --- /dev/null +++ b/6-mobx-react/src/index.html @@ -0,0 +1,9 @@ + + + + + +
+ + + diff --git a/6-mobx-react/src/js/TodoList.js b/6-mobx-react/src/js/TodoList.js new file mode 100644 index 00000000..7fc5a3db --- /dev/null +++ b/6-mobx-react/src/js/TodoList.js @@ -0,0 +1,37 @@ +import React from "react" +import { observer } from "mobx-react" + + +@observer +export default class TodoList extends React.Component { + createNew(e) { + if (e.which === 13) { + this.props.store.createTodo(e.target.value) + e.target.value = "" + } + } + + filter(e) { + this.props.store.filter = e.target.value + } + + toggleComplete(todo) { + todo.complete = !todo.complete + } + + render() { + const { clearComplete, filter, filteredTodos, todos } = this.props.store + + const todoLis = filteredTodos.map(todo => ( +
  • + {todo.value}
  • + )) + return
    +

    todos

    + + +
      {todoLis}
    + Clear Complete +
    + } +} diff --git a/6-mobx-react/src/js/TodoStore.js b/6-mobx-react/src/js/TodoStore.js new file mode 100644 index 00000000..7a40b5cd --- /dev/null +++ b/6-mobx-react/src/js/TodoStore.js @@ -0,0 +1,34 @@ +import { computed, observable } from "mobx" + +class Todo { + @observable value + @observable id + @observable complete + + constructor(value) { + this.value = value + this.id = Date.now() + this.complete = false + } +} + +export class TodoStore { + @observable todos = [] + @observable filter = "" + @computed get filteredTodos() { + var matchesFilter = new RegExp(this.filter, "i") + return this.todos.filter(todo => !this.filter || matchesFilter.test(todo.value)) + } + + createTodo(value) { + this.todos.push(new Todo(value)) + } + + clearComplete = () => { + const incompleteTodos = this.todos.filter(todo => !todo.complete) + this.todos.replace(incompleteTodos) + } +} + +export default new TodoStore + diff --git a/6-mobx-react/src/js/main.js b/6-mobx-react/src/js/main.js new file mode 100644 index 00000000..6672df8a --- /dev/null +++ b/6-mobx-react/src/js/main.js @@ -0,0 +1,10 @@ +import "../css/main.css" +import React from "react" +import ReactDOM from "react-dom" +import TodoStore from "./TodoStore" +import TodoList from "./TodoList" + +const app = document.getElementById("app") + +ReactDOM.render(, app) + diff --git a/6-mobx-react/webpack.config.js b/6-mobx-react/webpack.config.js new file mode 100644 index 00000000..7c467bef --- /dev/null +++ b/6-mobx-react/webpack.config.js @@ -0,0 +1,28 @@ +var debug = process.env.NODE_ENV !== "production"; +var webpack = require('webpack'); +var path = require('path'); + +module.exports = { + context: path.join(__dirname, "src"), + devtool: debug ? "inline-sourcemap" : null, + entry: "./js/main.js", + module: { + loaders: [ + { + test: /\.js$/, + exclude: /(node_modules|bower_components)/, + loader: 'babel-loader', + }, + { test: /\.css$/, loader: "style-loader!css-loader" }, + ] + }, + output: { + path: path.join(__dirname, "src"), + filename: "main.min.js" + }, + plugins: debug ? [] : [ + new webpack.optimize.DedupePlugin(), + new webpack.optimize.OccurenceOrderPlugin(), + new webpack.optimize.UglifyJsPlugin({ mangle: false, sourcemap: false }), + ], +}; From d0752f66bdbb62035270c671299e39c10817b4f5 Mon Sep 17 00:00:00 2001 From: Will Stern Date: Thu, 25 Aug 2016 21:02:52 -0500 Subject: [PATCH 03/19] small tweaks --- 6-mobx-react/src/js/TodoList.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/6-mobx-react/src/js/TodoList.js b/6-mobx-react/src/js/TodoList.js index 7fc5a3db..b54204a8 100644 --- a/6-mobx-react/src/js/TodoList.js +++ b/6-mobx-react/src/js/TodoList.js @@ -24,11 +24,13 @@ export default class TodoList extends React.Component { const todoLis = filteredTodos.map(todo => (
  • - {todo.value}
  • + + {todo.value} + )) return

    todos

    - +
      {todoLis}
    Clear Complete From 6b8862e1e80a34e7b872acadb5e937b5a9d0bb91 Mon Sep 17 00:00:00 2001 From: Daniel Hoek Date: Wed, 31 Aug 2016 12:38:30 +1000 Subject: [PATCH 04/19] Swapping around plugins swapped 'transform-decorators-legacy' and 'transform-class-properties' as when the 'decorator' goes after 'class' plugin then the ES7 decorators seem to get ignored. i ran into this issue once i started using decorators in mobx tutorial (which has them the correct way around) --- 1-basic-react/webpack.config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/1-basic-react/webpack.config.js b/1-basic-react/webpack.config.js index e31a6282..916380db 100644 --- a/1-basic-react/webpack.config.js +++ b/1-basic-react/webpack.config.js @@ -14,7 +14,7 @@ module.exports = { loader: 'babel-loader', query: { presets: ['react', 'es2015', 'stage-0'], - plugins: ['react-html-attrs', 'transform-class-properties', 'transform-decorators-legacy'], + plugins: ['react-html-attrs', 'transform-decorators-legacy', 'transform-class-properties'], } } ] From 1badc88b14ffca32260d2a72a38af1640780390c Mon Sep 17 00:00:00 2001 From: Alex Z Date: Sun, 9 Oct 2016 00:45:37 -0400 Subject: [PATCH 05/19] got rid of babel core error when running npm run dev --- 1-basic-react/package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/1-basic-react/package.json b/1-basic-react/package.json index e7402666..fd95df04 100644 --- a/1-basic-react/package.json +++ b/1-basic-react/package.json @@ -16,6 +16,7 @@ "react-dom": "^0.14.6", "webpack": "^1.12.9", "webpack-dev-server": "^1.14.1" + "babel-core": "^6.17.0", }, "devDependencies": {}, "scripts": { From 0a366b54f03bd84bc513856c566e70cf25f69ed9 Mon Sep 17 00:00:00 2001 From: "S. Alexander Zaman" Date: Mon, 10 Oct 2016 17:56:21 -0400 Subject: [PATCH 06/19] fixed ordering --- 1-basic-react/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/1-basic-react/package.json b/1-basic-react/package.json index fd95df04..109c3320 100644 --- a/1-basic-react/package.json +++ b/1-basic-react/package.json @@ -4,6 +4,7 @@ "description": "", "main": "webpack.config.js", "dependencies": { + "babel-core": "^6.17.0", "babel-loader": "^6.2.0", "babel-plugin-add-module-exports": "^0.1.2", "babel-plugin-react-html-attrs": "^2.0.0", @@ -16,7 +17,6 @@ "react-dom": "^0.14.6", "webpack": "^1.12.9", "webpack-dev-server": "^1.14.1" - "babel-core": "^6.17.0", }, "devDependencies": {}, "scripts": { From bf336d945f87314b1c45060101d0de46e1137a61 Mon Sep 17 00:00:00 2001 From: Fabian Beuke Date: Fri, 21 Oct 2016 11:32:42 +0200 Subject: [PATCH 07/19] remove scripts dev modules bin path as stated in the youtube tutorial the full path to the npm module binary "./node_modules/.bin/" is not necessary, in case you start the script via npm run --- 1-basic-react/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/1-basic-react/package.json b/1-basic-react/package.json index 109c3320..9c1ac7e2 100644 --- a/1-basic-react/package.json +++ b/1-basic-react/package.json @@ -20,7 +20,7 @@ }, "devDependencies": {}, "scripts": { - "dev": "./node_modules/.bin/webpack-dev-server --content-base src --inline --hot", + "dev": "webpack-dev-server --content-base src --inline --hot", "test": "echo \"Error: no test specified\" && exit 1" }, "author": "", From 15fa5fa5c7989d60411b027eba547ef7c87eef26 Mon Sep 17 00:00:00 2001 From: Klaus Etgeton Date: Mon, 7 Nov 2016 22:00:16 -0200 Subject: [PATCH 08/19] Added dependecy thatt was missing, babel-core, when running as dev --- 5-redux-react/package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/5-redux-react/package.json b/5-redux-react/package.json index 141fb42d..bf4c684e 100644 --- a/5-redux-react/package.json +++ b/5-redux-react/package.json @@ -5,6 +5,7 @@ "main": "webpack.config.js", "dependencies": { "axios": "^0.12.0", + "babel-core": "^6.18.2", "babel-loader": "^6.2.0", "babel-plugin-add-module-exports": "^0.1.2", "babel-plugin-react-html-attrs": "^2.0.0", From 915bb775ab30f3fcf547229b35eea97de8f049c4 Mon Sep 17 00:00:00 2001 From: Dave Voyles Date: Tue, 8 Nov 2016 15:14:03 -0500 Subject: [PATCH 09/19] Instructions and YouTube time stamps --- 1-basic-react/README.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 1-basic-react/README.md diff --git a/1-basic-react/README.md b/1-basic-react/README.md new file mode 100644 index 00000000..580ad65b --- /dev/null +++ b/1-basic-react/README.md @@ -0,0 +1,17 @@ +## Instructions to run +1. Navigate to folder */1-basic-react* +2. *NPM install* +3. *NPM run dev* +4. Navigate to localhost:8080 + +## Time stamps from [YouTube video](https://www.youtube.com/watch?v=MhkGQAoc7bc) +* 0:50 Babel overview +* 1:29 Webpack config +* 2:37 NPM install +* 3:13 Looking at client.js & breaking down React +* 5:45 Serving content from file +* 6:18 Live reload w/ npm install -S webpack-dev-server +* 7:10 webpack dev server --content-base src +* 7:55 --Inline --hot (live reload) +* 8:30 Creating a "dev" command in NPM + From 51390bce547e32f34e695763a937a942ff9ce6fa Mon Sep 17 00:00:00 2001 From: Kutsan Kaplan Date: Sun, 13 Nov 2016 01:48:08 +0200 Subject: [PATCH 10/19] Missing babel-core added --- 3-flux/package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/3-flux/package.json b/3-flux/package.json index d04fdd7a..61aab93e 100644 --- a/3-flux/package.json +++ b/3-flux/package.json @@ -4,6 +4,7 @@ "description": "", "main": "webpack.config.js", "dependencies": { + "babel-core": "^6.18.2", "babel-loader": "^6.2.0", "babel-plugin-add-module-exports": "^0.1.2", "babel-plugin-react-html-attrs": "^2.0.0", From ca787e75a4d0b2ded9c77cce2fdacea53ad4f0a2 Mon Sep 17 00:00:00 2001 From: Will Stern Date: Mon, 14 Nov 2016 09:13:14 -0600 Subject: [PATCH 11/19] added babel-core --- 2-react-router/package.json | 1 + 4-redux/package.json | 1 + 6-mobx-react/package.json | 1 + 3 files changed, 3 insertions(+) diff --git a/2-react-router/package.json b/2-react-router/package.json index 338f9afa..bd03fb8d 100644 --- a/2-react-router/package.json +++ b/2-react-router/package.json @@ -4,6 +4,7 @@ "description": "", "main": "webpack.config.js", "dependencies": { + "babel-core": "^6.17.0", "babel-loader": "^6.2.0", "babel-plugin-add-module-exports": "^0.1.2", "babel-plugin-react-html-attrs": "^2.0.0", diff --git a/4-redux/package.json b/4-redux/package.json index 5606144d..47461630 100644 --- a/4-redux/package.json +++ b/4-redux/package.json @@ -5,6 +5,7 @@ "main": "webpack.config.js", "dependencies": { "axios": "^0.12.0", + "babel-core": "^6.17.0", "babel-loader": "^6.2.0", "babel-plugin-add-module-exports": "^0.1.2", "babel-plugin-react-html-attrs": "^2.0.0", diff --git a/6-mobx-react/package.json b/6-mobx-react/package.json index bbb08817..2bafc21d 100644 --- a/6-mobx-react/package.json +++ b/6-mobx-react/package.json @@ -16,6 +16,7 @@ "react-dom": "^15.3.0" }, "devDependencies": { + "babel-core": "^6.17.0", "babel-loader": "^6.2.4", "babel-plugin-transform-class-properties": "^6.10.2", "babel-plugin-transform-decorators-legacy": "^1.3.4", From 4cb30ee5ac00054ee10c973f49ab8b0b4972f1e9 Mon Sep 17 00:00:00 2001 From: Salem Baira Date: Wed, 1 Feb 2017 21:45:40 +0000 Subject: [PATCH 12/19] fix babel presets and plugins --- 6-mobx-react/webpack.config.js | 1 + 1 file changed, 1 insertion(+) diff --git a/6-mobx-react/webpack.config.js b/6-mobx-react/webpack.config.js index 7c467bef..de21163e 100644 --- a/6-mobx-react/webpack.config.js +++ b/6-mobx-react/webpack.config.js @@ -12,6 +12,7 @@ module.exports = { test: /\.js$/, exclude: /(node_modules|bower_components)/, loader: 'babel-loader', + query: { presets: ['es2015', 'react'], plugins: ["transform-decorators-legacy", "transform-class-properties"] } }, { test: /\.css$/, loader: "style-loader!css-loader" }, ] From b01cadc8df6c5e73c8bc7f89de2e26b582978164 Mon Sep 17 00:00:00 2001 From: "Timothy J. Sayre" Date: Mon, 20 Feb 2017 13:57:30 -0800 Subject: [PATCH 13/19] Update Todos.js Updated class name to avoid confusion. --- 3-flux/src/js/pages/Todos.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/3-flux/src/js/pages/Todos.js b/3-flux/src/js/pages/Todos.js index ff248c83..5e145b9a 100644 --- a/3-flux/src/js/pages/Todos.js +++ b/3-flux/src/js/pages/Todos.js @@ -5,7 +5,7 @@ import * as TodoActions from "../actions/TodoActions"; import TodoStore from "../stores/TodoStore"; -export default class Featured extends React.Component { +export default class Todos extends React.Component { constructor() { super(); this.getTodos = this.getTodos.bind(this); From 7b15d9acc88810f0cea10257a6d8d8d69a0c03fa Mon Sep 17 00:00:00 2001 From: achmiral Date: Sun, 26 Feb 2017 21:33:04 +0700 Subject: [PATCH 14/19] ADD: tweet.id as the unique key of mapped tweet item --- 5-redux-react/src/js/components/Layout.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/5-redux-react/src/js/components/Layout.js b/5-redux-react/src/js/components/Layout.js index 41517fb3..8d416cd7 100644 --- a/5-redux-react/src/js/components/Layout.js +++ b/5-redux-react/src/js/components/Layout.js @@ -27,7 +27,7 @@ export default class Layout extends React.Component { return } - const mappedTweets = tweets.map(tweet =>
  • {tweet.text}
  • ) + const mappedTweets = tweets.map(tweet =>
  • {tweet.text}
  • ) return

    {user.name}

    From 25ec17eb9e0bcbdcde209e0c7b46c647171a1c58 Mon Sep 17 00:00:00 2001 From: Will Stern Date: Mon, 27 Mar 2017 09:31:12 -0500 Subject: [PATCH 15/19] Revert "make components "active" using appropriate props" --- 2-react-router/src/js/components/layout/Nav.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/2-react-router/src/js/components/layout/Nav.js b/2-react-router/src/js/components/layout/Nav.js index b768499b..5657e27b 100644 --- a/2-react-router/src/js/components/layout/Nav.js +++ b/2-react-router/src/js/components/layout/Nav.js @@ -17,9 +17,9 @@ export default class Nav extends React.Component { render() { const { location } = this.props; const { collapsed } = this.state; - // const featuredClass = location.pathname === "/" ? "active" : ""; - // const archivesClass = location.pathname.match(/^\/archives/) ? "active" : ""; - // const settingsClass = location.pathname.match(/^\/settings/) ? "active" : ""; + const featuredClass = location.pathname === "/" ? "active" : ""; + const archivesClass = location.pathname.match(/^\/archives/) ? "active" : ""; + const settingsClass = location.pathname.match(/^\/settings/) ? "active" : ""; const navClass = collapsed ? "collapse" : ""; return ( @@ -35,13 +35,13 @@ export default class Nav extends React.Component {
    From aa871682fe1d2cd8a2bc92651b616ea35d39e1ba Mon Sep 17 00:00:00 2001 From: Thibault Jan Beyer Date: Sat, 15 Apr 2017 14:08:58 +0200 Subject: [PATCH 16/19] Update webpack.config.js MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - it’s occurrence with two 'r' - should be 'false' not 'null' --- 1-basic-react/webpack.config.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/1-basic-react/webpack.config.js b/1-basic-react/webpack.config.js index 916380db..6ba7dd8f 100644 --- a/1-basic-react/webpack.config.js +++ b/1-basic-react/webpack.config.js @@ -4,7 +4,7 @@ var path = require('path'); module.exports = { context: path.join(__dirname, "src"), - devtool: debug ? "inline-sourcemap" : null, + devtool: debug ? "inline-sourcemap" : false, entry: "./js/client.js", module: { loaders: [ @@ -25,7 +25,7 @@ module.exports = { }, plugins: debug ? [] : [ new webpack.optimize.DedupePlugin(), - new webpack.optimize.OccurenceOrderPlugin(), + new webpack.optimize.OccurrenceOrderPlugin(), new webpack.optimize.UglifyJsPlugin({ mangle: false, sourcemap: false }), ], }; From 8f1d3142e984d6e18ad4fef09da46c2daff3b5d1 Mon Sep 17 00:00:00 2001 From: Will Stern Date: Tue, 2 May 2017 12:54:37 -0500 Subject: [PATCH 17/19] Update tweetsActions.js --- 5-redux-react/src/js/actions/tweetsActions.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/5-redux-react/src/js/actions/tweetsActions.js b/5-redux-react/src/js/actions/tweetsActions.js index cba31e31..078064bb 100644 --- a/5-redux-react/src/js/actions/tweetsActions.js +++ b/5-redux-react/src/js/actions/tweetsActions.js @@ -2,7 +2,13 @@ import axios from "axios"; export function fetchTweets() { return function(dispatch) { - axios.get("http://rest.learncode.academy/api/test123/tweets") + /* + http://rest.learncode.academy is a public test server, so another user's experimentation can break your tests + If you get console errors due to bad data: + - change "reacttest" below to any other username + - post some tweets to http://rest.learncode.academy/api/yourusername + */ + axios.get("http://rest.learncode.academy/api/reacttest/tweets") .then((response) => { dispatch({type: "FETCH_TWEETS_FULFILLED", payload: response.data}) }) From 14c11ad4e349f11500a0701723839959d5c23c8e Mon Sep 17 00:00:00 2001 From: Will Stern Date: Tue, 2 May 2017 12:55:51 -0500 Subject: [PATCH 18/19] Update tweetsActions.js --- 5-redux-react/src/js/actions/tweetsActions.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/5-redux-react/src/js/actions/tweetsActions.js b/5-redux-react/src/js/actions/tweetsActions.js index 078064bb..edf6ed0d 100644 --- a/5-redux-react/src/js/actions/tweetsActions.js +++ b/5-redux-react/src/js/actions/tweetsActions.js @@ -6,7 +6,7 @@ export function fetchTweets() { http://rest.learncode.academy is a public test server, so another user's experimentation can break your tests If you get console errors due to bad data: - change "reacttest" below to any other username - - post some tweets to http://rest.learncode.academy/api/yourusername + - post some tweets to http://rest.learncode.academy/api/yourusername/tweets */ axios.get("http://rest.learncode.academy/api/reacttest/tweets") .then((response) => { From 23b30f0f547b9e1c95f29e5364745c4510f515b3 Mon Sep 17 00:00:00 2001 From: Will Stern Date: Tue, 23 May 2017 09:42:48 -0500 Subject: [PATCH 19/19] dispatch FETCH_TWEETS --- 5-redux-react/src/js/actions/tweetsActions.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/5-redux-react/src/js/actions/tweetsActions.js b/5-redux-react/src/js/actions/tweetsActions.js index edf6ed0d..87926d0f 100644 --- a/5-redux-react/src/js/actions/tweetsActions.js +++ b/5-redux-react/src/js/actions/tweetsActions.js @@ -2,6 +2,8 @@ import axios from "axios"; export function fetchTweets() { return function(dispatch) { + dispatch({type: "FETCH_TWEETS"}); + /* http://rest.learncode.academy is a public test server, so another user's experimentation can break your tests If you get console errors due to bad data: