-
-
Notifications
You must be signed in to change notification settings - Fork 15.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Port examples to use Create React App (#1883)
* Rename examples => examples_old * Port counter and counter-vanilla * Port async example * Port todos example * Port todos-with-undo example * Port some tests over * Add todomvc example * Ported shopping-cart example * Ported tree-view * Ported real-world * Add missing dep * Temp fix install until examples get an equivalent to buildAll.js * Restore example build scripts. * Bump react-scripts * Finish porting examples
- Loading branch information
Showing
176 changed files
with
823 additions
and
1,124 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# See http://help.github.com/ignore-files/ for more about ignoring files. | ||
|
||
# dependencies | ||
node_modules | ||
|
||
# production | ||
build | ||
|
||
# misc | ||
.DS_Store | ||
npm-debug.log |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# Redux Async Example | ||
|
||
This project template was built with [Create React App](https://github.com/facebookincubator/create-react-app). | ||
|
||
## Available Scripts | ||
|
||
In the project directory, you can run: | ||
|
||
### `npm start` | ||
|
||
Runs the app in the development mode.<br> | ||
Open [http://localhost:3000](http://localhost:3000) to view it in the browser. | ||
|
||
The page will reload if you make edits.<br> | ||
You will also see any lint errors in the console. | ||
|
||
### `npm run build` | ||
|
||
Builds the app for production to the `build` folder.<br> | ||
It correctly bundles React in production mode and optimizes the build for the best performance. | ||
|
||
The build is minified and the filenames include the hashes.<br> | ||
Your app is ready to be deployed! | ||
|
||
### `npm run eject` | ||
|
||
**Note: this is a one-way operation. Once you `eject`, you can’t go back!** | ||
|
||
If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project. | ||
|
||
Instead, it will copy all the configuration files and the transitive dependencies (Webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own. | ||
|
||
You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it. | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,21 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<title>Redux async example</title> | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1"> | ||
<title>Redux Async Example</title> | ||
</head> | ||
<body> | ||
<div id="root"> | ||
</div> | ||
<script src="/static/bundle.js"></script> | ||
<div id="root"></div> | ||
<!-- | ||
This HTML file is a template. | ||
If you open it directly in the browser, you will see an empty page. | ||
You can add webfonts, meta tags, or analytics to this file. | ||
The build step will place the bundled scripts into the <body> tag. | ||
To begin the development, run `npm start` in this folder. | ||
To create a production bundle, use `npm run build`. | ||
--> | ||
</body> | ||
</html> |
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,51 +1,24 @@ | ||
{ | ||
"name": "redux-async-example", | ||
"version": "0.0.0", | ||
"description": "Redux async example", | ||
"scripts": { | ||
"start": "node server.js" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/reactjs/redux.git" | ||
}, | ||
"keywords": [ | ||
"react", | ||
"reactjs", | ||
"hot", | ||
"reload", | ||
"hmr", | ||
"live", | ||
"edit", | ||
"webpack", | ||
"flux" | ||
], | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/reactjs/redux/issues" | ||
"name": "async", | ||
"version": "0.0.1", | ||
"private": true, | ||
"devDependencies": { | ||
"react-scripts": "^0.4.0", | ||
"redux-logger": "^2.6.1" | ||
}, | ||
"homepage": "http://redux.js.org", | ||
"dependencies": { | ||
"babel-polyfill": "^6.3.14", | ||
"isomorphic-fetch": "^2.1.1", | ||
"react": "^0.14.7", | ||
"react-dom": "^0.14.7", | ||
"react-redux": "^4.2.1", | ||
"redux": "^3.2.1", | ||
"redux-logger": "^2.4.0", | ||
"redux-thunk": "^1.0.3" | ||
"react": "^15.3.0", | ||
"react-dom": "^15.3.0", | ||
"react-redux": "^4.4.5", | ||
"redux": "^3.5.2", | ||
"redux-thunk": "^2.1.0" | ||
}, | ||
"devDependencies": { | ||
"babel-core": "^6.3.15", | ||
"babel-loader": "^6.2.0", | ||
"babel-preset-es2015": "^6.3.13", | ||
"babel-preset-react": "^6.3.13", | ||
"babel-preset-react-hmre": "^1.1.1", | ||
"expect": "^1.6.0", | ||
"express": "^4.13.3", | ||
"node-libs-browser": "^0.5.2", | ||
"webpack": "^1.9.11", | ||
"webpack-dev-middleware": "^1.2.0", | ||
"webpack-hot-middleware": "^2.9.1" | ||
"scripts": { | ||
"start": "react-scripts start", | ||
"build": "react-scripts build", | ||
"eject": "react-scripts eject" | ||
}, | ||
"eslintConfig": { | ||
"extends": "./node_modules/react-scripts/config/eslint.js" | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
2 changes: 0 additions & 2 deletions
2
examples/async/actions/index.js → examples/async/src/actions/index.js
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import React from 'react' | ||
import { render } from 'react-dom' | ||
import { createStore, applyMiddleware } from 'redux' | ||
import { Provider } from 'react-redux' | ||
import thunk from 'redux-thunk' | ||
import createLogger from 'redux-logger' | ||
import reducer from './reducers' | ||
import App from './containers/App' | ||
|
||
const middleware = [ thunk ] | ||
if (process.env.NODE_ENV !== 'production') { | ||
middleware.push(createLogger()) | ||
} | ||
|
||
const store = createStore( | ||
reducer, | ||
applyMiddleware(...middleware) | ||
) | ||
|
||
render( | ||
<Provider store={store}> | ||
<App /> | ||
</Provider>, | ||
document.getElementById('root') | ||
) |
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
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# See http://help.github.com/ignore-files/ for more about ignoring files. | ||
|
||
# dependencies | ||
node_modules | ||
|
||
# production | ||
build | ||
|
||
# misc | ||
.DS_Store | ||
npm-debug.log |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# Redux Counter Example | ||
|
||
This project template was built with [Create React App](https://github.com/facebookincubator/create-react-app). | ||
|
||
## Available Scripts | ||
|
||
In the project directory, you can run: | ||
|
||
### `npm start` | ||
|
||
Runs the app in the development mode.<br> | ||
Open [http://localhost:3000](http://localhost:3000) to view it in the browser. | ||
|
||
The page will reload if you make edits.<br> | ||
You will also see any lint errors in the console. | ||
|
||
### `npm run build` | ||
|
||
Builds the app for production to the `build` folder.<br> | ||
It correctly bundles React in production mode and optimizes the build for the best performance. | ||
|
||
The build is minified and the filenames include the hashes.<br> | ||
Your app is ready to be deployed! | ||
|
||
### `npm run eject` | ||
|
||
**Note: this is a one-way operation. Once you `eject`, you can’t go back!** | ||
|
||
If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project. | ||
|
||
Instead, it will copy all the configuration files and the transitive dependencies (Webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own. | ||
|
||
You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it. |
Oops, something went wrong.
7296d3c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gaearon Any reason why the reducer specs don't call the reducers' access methods? Eg. in the shopping-cart example, products.spec.js could make use of products.getProduct().
7296d3c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No real reason. Nobody really worked on those tests since they were written, and there are many things that could’ve been done better. 😛