aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--package.json1
-rw-r--r--src/index.js8
-rw-r--r--yarn.lock12
3 files changed, 19 insertions, 2 deletions
diff --git a/package.json b/package.json
index f209c7b..60803d4 100644
--- a/package.json
+++ b/package.json
@@ -10,6 +10,7 @@
"react": "^17.0.1",
"react-dom": "^17.0.1",
"react-scripts": "4.0.0",
+ "swr": "^0.3.8",
"web-vitals": "^0.2.4"
},
"scripts": {
diff --git a/src/index.js b/src/index.js
index c965911..ea743ca 100644
--- a/src/index.js
+++ b/src/index.js
@@ -1,12 +1,16 @@
import React from "react";
import ReactDOM from "react-dom";
+import { SWRConfig } from "swr";
import "./index.css";
import App from "./App";
-import reportWebVitals from "./reportWebVitals";
+
+const fetcher = (...args) => fetch(...args).then((res) => res.json());
ReactDOM.render(
<React.StrictMode>
- <App />
+ <SWRConfig value={{ fetcher }}>
+ <App />
+ </SWRConfig>
</React.StrictMode>,
document.getElementById("root")
);
diff --git a/yarn.lock b/yarn.lock
index 77c4689..6ff2a88 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -3872,6 +3872,11 @@ depd@~1.1.2:
resolved "https://registry.yarnpkg.com/depd/-/depd-1.1.2.tgz#9bcd52e14c097763e749b274c4346ed2e560b5a9"
integrity sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=
+dequal@2.0.2:
+ version "2.0.2"
+ resolved "https://registry.yarnpkg.com/dequal/-/dequal-2.0.2.tgz#85ca22025e3a87e65ef75a7a437b35284a7e319d"
+ integrity sha512-q9K8BlJVxK7hQYqa6XISGmBZbtQQWVXSrRrWreHC94rMt1QL/Impruc+7p2CYSYuVIUr+YCt6hjrs1kkdJRTug==
+
des.js@^1.0.0:
version "1.0.1"
resolved "https://registry.yarnpkg.com/des.js/-/des.js-1.0.1.tgz#5382142e1bdc53f85d86d53e5f4aa7deb91e0843"
@@ -10317,6 +10322,13 @@ svgo@^1.0.0, svgo@^1.2.2:
unquote "~1.1.1"
util.promisify "~1.0.0"
+swr@^0.3.8:
+ version "0.3.8"
+ resolved "https://registry.yarnpkg.com/swr/-/swr-0.3.8.tgz#b3c3c7fa278913d22dbe1f3f28c07df9da9be944"
+ integrity sha512-EHRlaqoBtHsB2wOB+dQJ74DrZvaRGu4BaIQrhkD+/rj8/UGo2iQXN+rCcYnV7/VAreBJBmm9+lDkwZmUqWEkKA==
+ dependencies:
+ dequal "2.0.2"
+
symbol-tree@^3.2.4:
version "3.2.4"
resolved "https://registry.yarnpkg.com/symbol-tree/-/symbol-tree-3.2.4.tgz#430637d248ba77e078883951fb9aa0eed7c63fa2"