Skip to content

Commit 5d1442a

Browse files
committed
Merge branch 'master' into useAsync
2 parents 46f8b8c + 450aad8 commit 5d1442a

File tree

25 files changed

+371
-7129
lines changed

25 files changed

+371
-7129
lines changed

.eslintrc

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"extends": [
3+
"plugin:prettier/recommended",
4+
"plugin:promise/recommended",
5+
"plugin:react/recommended"
6+
],
7+
"parser": "babel-eslint",
8+
"parserOptions": {
9+
"ecmaFeatures": {
10+
"jsx": true
11+
}
12+
},
13+
"plugins": ["jest", "promise", "react"],
14+
"rules": {
15+
"react/prop-types": "off"
16+
},
17+
"settings": {
18+
"react": {
19+
"version": "16.3"
20+
}
21+
}
22+
}

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
lib/
22
node_modules/
3-
coverage/
3+
coverage/
4+
package-lock.json

.prettierrc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"printWidth": 100,
3+
"semi": false,
4+
"trailingComma": "es5"
5+
}

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,8 @@ import { createInstance } from "react-async"
170170

171171
const loadCustomer = ({ customerId }) => fetch(`/api/customers/${customerId}`).then(...)
172172

173-
const AsyncCustomer = createInstance({ promiseFn: loadCustomer })
173+
// createInstance takes a defaultProps object and a displayName (both optional)
174+
const AsyncCustomer = createInstance({ promiseFn: loadCustomer }, "AsyncCustomer")
174175

175176
const MyComponent = () => (
176177
<AsyncCustomer customerId="123">

examples/basic-fetch/.env

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
SKIP_PREFLIGHT_CHECK=true

examples/basic-fetch/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[![Deploy to now](https://deploy.now.sh/static/button.svg)](https://deploy.now.sh/?repo=https://github.com/ghengeveld/react-async/tree/master/examples/basic-fetch)
2+
3+
# Basic fetch with React Async
4+
5+
This demonstrates a very simple HTTP GET using `fetch`, wrapped with React Async.

examples/basic-fetch/now.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"version": 2,
3+
"builds": [{ "src": "package.json", "use": "@now/static-build" }],
4+
"routes": [
5+
{ "src": "^/static/(.*)", "dest": "/static/$1" },
6+
{ "src": "^/favicon.ico", "dest": "/favicon.ico" },
7+
{ "src": "^/(.*)", "dest": "/index.html" }
8+
]
9+
}

examples/basic-fetch/package.json

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"name": "basic-fetch",
3+
"version": "0.0.0",
4+
"private": true,
5+
"dependencies": {
6+
"react": "^16.7.0",
7+
"react-async": "latest",
8+
"react-dom": "^16.7.0",
9+
"react-scripts": "2.1.2"
10+
},
11+
"scripts": {
12+
"start": "react-scripts start",
13+
"build": "react-scripts build",
14+
"now-build": "npm run build && mv build dist"
15+
},
16+
"eslintConfig": {
17+
"extends": "react-app"
18+
},
19+
"browserslist": [
20+
">0.2%",
21+
"not dead",
22+
"not ie <= 11",
23+
"not op_mini all"
24+
]
25+
}
3.78 KB
Binary file not shown.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8" />
5+
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
6+
<meta name="theme-color" content="#000000" />
7+
<title>React App</title>
8+
</head>
9+
<body>
10+
<noscript> You need to enable JavaScript to run this app. </noscript>
11+
<div id="root"></div>
12+
</body>
13+
</html>

0 commit comments

Comments
 (0)