Skip to content

Commit e8c72a9

Browse files
committed
Readme + media
1 parent d44aec4 commit e8c72a9

19 files changed

+10543
-3
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
![React Query Header](https://github.com/tannerlinsley/react-query/raw/master/media/header.png)
1+
![React Query Header](https://github.com/tannerlinsley/react-query/raw/master/media/repo-dark.png)
22

3-
<img src='https://github.com/tannerlinsley/react-query/raw/master/media/logo.png' width='300'/>
3+
<img src='https://github.com/tannerlinsley/react-query/raw/master/media/logo-light.png' width='300'/>
44

55
Hooks for fetching, caching and updating asynchronous data in React
66

docs/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Formik Docs
1+
# React Query Docs
22

33
This is source code to react-query.tanstack.com. It is forked from the [Formik](https://formik.org) docs and is built with:
44

examples/simple/.babelrc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"presets": ["react-app"],
3+
"plugins": ["styled-components"]
4+
}

examples/simple/.eslintrc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"extends": ["react-app", "prettier"],
3+
"rules": {
4+
// "eqeqeq": 0,
5+
// "jsx-a11y/anchor-is-valid": 0
6+
}
7+
}

examples/simple/.gitignore

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
# dependencies
4+
/node_modules
5+
/.pnp
6+
.pnp.js
7+
8+
# testing
9+
/coverage
10+
11+
# production
12+
/build
13+
14+
# misc
15+
.DS_Store
16+
.env.local
17+
.env.development.local
18+
.env.test.local
19+
.env.production.local
20+
21+
npm-debug.log*
22+
yarn-debug.log*
23+
yarn-error.log*

examples/simple/.prettierrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{}

examples/simple/.rescriptsrc.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
const path = require('path')
2+
const resolveFrom = require('resolve-from')
3+
4+
const fixLinkedDependencies = config => {
5+
config.resolve = {
6+
...config.resolve,
7+
alias: {
8+
...config.resolve.alias,
9+
react$: resolveFrom(path.resolve('node_modules'), 'react'),
10+
'react-dom$': resolveFrom(path.resolve('node_modules'), 'react-dom'),
11+
},
12+
}
13+
return config
14+
}
15+
16+
const includeSrcDirectory = config => {
17+
config.resolve = {
18+
...config.resolve,
19+
modules: [path.resolve('src'), ...config.resolve.modules],
20+
}
21+
return config
22+
}
23+
24+
module.exports = [
25+
['use-babel-config', '.babelrc'],
26+
['use-eslint-config', '.eslintrc'],
27+
fixLinkedDependencies,
28+
// includeSrcDirectory,
29+
]

examples/simple/README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Example
2+
3+
To run this example:
4+
5+
- `npm install` or `yarn`
6+
- `npm run start` or `yarn start`

examples/simple/package.json

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
{
2+
"private": true,
3+
"scripts": {
4+
"start": "rescripts start",
5+
"build": "rescripts build",
6+
"test": "rescripts test",
7+
"eject": "rescripts eject"
8+
},
9+
"dependencies": {
10+
"axios": "0.19.2",
11+
"react": "^16.8.6",
12+
"react-dom": "^16.8.6",
13+
"react-query": "1.0.12",
14+
"react-query-devtools": "1.0.2",
15+
"react-scripts": "3.0.1",
16+
"stop-runaway-react-effects": "^1.2.0",
17+
"styled-components": "^4.3.2"
18+
},
19+
"devDependencies": {
20+
"@rescripts/cli": "^0.0.11",
21+
"@rescripts/rescript-use-babel-config": "^0.0.8",
22+
"@rescripts/rescript-use-eslint-config": "^0.0.9",
23+
"babel-eslint": "10.0.1"
24+
},
25+
"browserslist": {
26+
"production": [
27+
">0.2%",
28+
"not dead",
29+
"not op_mini all"
30+
],
31+
"development": [
32+
"last 1 chrome version",
33+
"last 1 firefox version",
34+
"last 1 safari version"
35+
]
36+
}
37+
}

examples/simple/public/favicon.ico

3.78 KB
Binary file not shown.

examples/simple/public/index.html

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8" />
5+
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1" />
7+
<meta name="theme-color" content="#000000" />
8+
<!--
9+
manifest.json provides metadata used when your web app is installed on a
10+
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
11+
-->
12+
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
13+
<!--
14+
Notice the use of %PUBLIC_URL% in the tags above.
15+
It will be replaced with the URL of the `public` folder during the build.
16+
Only files inside the `public` folder can be referenced from the HTML.
17+
18+
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
19+
work correctly both with client-side routing and a non-root public URL.
20+
Learn how to configure a non-root public URL by running `npm run build`.
21+
-->
22+
<title>React App</title>
23+
</head>
24+
<body>
25+
<noscript>You need to enable JavaScript to run this app.</noscript>
26+
<div id="root"></div>
27+
<!--
28+
This HTML file is a template.
29+
If you open it directly in the browser, you will see an empty page.
30+
31+
You can add webfonts, meta tags, or analytics to this file.
32+
The build step will place the bundled scripts into the <body> tag.
33+
34+
To begin the development, run `npm start` or `yarn start`.
35+
To create a production bundle, use `npm run build` or `yarn build`.
36+
-->
37+
</body>
38+
</html>

examples/simple/public/manifest.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"short_name": "React App",
3+
"name": "Create React App Sample",
4+
"icons": [
5+
{
6+
"src": "favicon.ico",
7+
"sizes": "64x64 32x32 24x24 16x16",
8+
"type": "image/x-icon"
9+
}
10+
],
11+
"start_url": ".",
12+
"display": "standalone",
13+
"theme_color": "#000000",
14+
"background_color": "#ffffff"
15+
}

examples/simple/src/index.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/* eslint-disable jsx-a11y/anchor-is-valid */
2+
import React from "react";
3+
import ReactDOM from "react-dom";
4+
import { useQuery } from "react-query";
5+
6+
export default function App() {
7+
const { isLoading, error, data } = useQuery("repoData", () =>
8+
fetch(
9+
"https://api.github.com/repos/tannerlinsley/react-query"
10+
).then((res) => res.json())
11+
);
12+
13+
if (isLoading) return "Loading...";
14+
15+
if (error) return "An error has occurred: " + error.message;
16+
17+
return (
18+
<div>
19+
<h1>{data.name}</h1>
20+
<p>{data.description}</p>
21+
<strong>👀 {data.subscribers_count}</strong>{" "}
22+
<strong>{data.stargazers_count}</strong>{" "}
23+
<strong>🍴 {data.forks_count}</strong>
24+
</div>
25+
);
26+
}
27+
28+
const rootElement = document.getElementById("root");
29+
ReactDOM.render(<App />, rootElement);

0 commit comments

Comments
 (0)