{"version":3,"sources":["components/Error.js","components/Fetching.js","lib/api.js","App.js","lib/hooks.js","reportWebVitals.js","index.js"],"names":["Error","Fetching","index","fetch","then","res","json","App","factories","loadFn","dependencies","useState","error","setError","length","fetching","setFetching","response","setResponse","asyncFetch","a","done","useEffect","catch","useMemo","useRemoteData","api","console","log","className","class","reportWebVitals","onPerfEntry","Function","getCLS","getFID","getFCP","getLCP","getTTFB","ReactDOM","render","StrictMode","document","getElementById"],"mappings":"oQAQeA,MANf,WACE,OACE,wECIWC,MANf,WACE,OACE,sDCJG,SAASC,IACd,OAAOC,MAAM,UACVC,MAAK,SAAAC,GAAG,OAAIA,EAAIC,U,kCC8BNC,MArBf,WACE,IAAMC,ECKD,SAAuBC,GAA4B,IAApBC,EAAmB,uDAAJ,GACnD,EAA0BC,mBAAS,MAAnC,mBAAOC,EAAP,KAAcC,EAAd,KACA,EAAgCF,mBAAiC,IAAxBD,EAAaI,QAAtD,mBAAOC,EAAP,KAAiBC,EAAjB,KACA,EAAgCL,mBAAS,MAAzC,mBAAOM,EAAP,KAAiBC,EAAjB,KAHuD,SAUxCC,IAVwC,2EAUvD,sBAAAC,EAAA,+EACSX,KADT,4CAVuD,sBAcvD,SAASY,IACPL,GAAY,GAOd,OAjBAM,qBAAU,WACRN,GAAY,GACZG,IAAaf,KAAKc,GAAaK,MAAMV,GAAUT,KAAKiB,KACnDX,GAUWc,mBAAQ,WACpB,MAAO,CAACZ,QAAOG,WAAUE,cACxB,CAACL,EAAOG,EAAUE,IDzBHQ,CAAcC,GAIhC,OAFAJ,qBAAU,WAAQK,QAAQC,IAAIpB,KAAc,CAACA,IAG3C,sBAAKqB,UAAU,MAAf,UACE,iCACE,qBAAKC,MAAM,cAAX,uBAEF,iCACGtB,EAAUO,UAAY,cAAC,EAAD,IACtBP,EAAUI,OAAS,cAAC,EAAD,IACnBJ,EAAUS,UACT,qDEbKc,EAZS,SAAAC,GAClBA,GAAeA,aAAuBC,UACxC,6BAAqB7B,MAAK,YAAkD,IAA/C8B,EAA8C,EAA9CA,OAAQC,EAAsC,EAAtCA,OAAQC,EAA8B,EAA9BA,OAAQC,EAAsB,EAAtBA,OAAQC,EAAc,EAAdA,QAC3DJ,EAAOF,GACPG,EAAOH,GACPI,EAAOJ,GACPK,EAAOL,GACPM,EAAQN,OCDdO,IAASC,OACP,cAAC,IAAMC,WAAP,UACE,cAAC,EAAD,MAEFC,SAASC,eAAe,SAM1BZ,M","file":"static/js/main.f3fd366c.chunk.js","sourcesContent":["import React from \"react\";\n\nfunction Error() {\n return (\n
86 on that ... something went wrong.
\n );\n}\n\nexport default Error;\n","import React from \"react\";\n\nfunction Fetching() {\n return (\n
Coming right up...
\n );\n}\n\nexport default Fetching;\n","export function index() {\n return fetch(\"./data\")\n .then(res => res.json());\n}\n","import { useEffect } from \"react\";\n\nimport './App.css';\nimport './layout.css';\n\nimport Error from \"components/Error\";\nimport Fetching from \"components/Fetching\";\n\nimport * as api from \"lib/api\";\nimport { useRemoteData } from \"lib/hooks\";\n\nfunction App() {\n const factories = useRemoteData(api.index);\n\n useEffect(() => { console.log(factories) }, [factories]);\n\n return (\n
\n
\n
testing
\n
\n
\n {factories.fetching && }\n {factories.error && }\n {factories.response && (\n

Hello, world.

\n )}\n
\n
\n );\n}\n\nexport default App;\n","// useRemoteData -- fetch remote data with standardized fetching and error states\n//\n// USAGE\n//\n// function fetchMyData() {\n// // ... return your data or a promise for your data ...\n// }\n//\n// const data = useRemoteData(fetchMyData);\n// // -- OR --\n// const data = useRemoteData(fetchMyData, dependencies);\n//\n// Similar to `useEffect`, `dependencies` will trigger the fetch to occur again.\n// `dependencies` defaults to [], meaning the fetch will happen only once.\n\n\nimport { useEffect, useMemo, useState } from \"react\";\nexport function useRemoteData(loadFn, dependencies = []) {\n const [error, setError] = useState(null);\n const [fetching, setFetching] = useState(dependencies.length === 0);\n const [response, setResponse] = useState(null);\n\n useEffect(() => {\n setFetching(true);\n asyncFetch().then(setResponse).catch(setError).then(done);\n }, dependencies);\n\n async function asyncFetch() {\n return loadFn();\n }\n\n function done() {\n setFetching(false);\n }\n\n const value = useMemo(() => {\n return {error, fetching, response};\n }, [error, fetching, response]);\n\n return value;\n}\n","const reportWebVitals = onPerfEntry => {\n if (onPerfEntry && onPerfEntry instanceof Function) {\n import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {\n getCLS(onPerfEntry);\n getFID(onPerfEntry);\n getFCP(onPerfEntry);\n getLCP(onPerfEntry);\n getTTFB(onPerfEntry);\n });\n }\n};\n\nexport default reportWebVitals;\n","import React from 'react';\nimport ReactDOM from 'react-dom';\nimport './index.css';\nimport App from './App';\nimport reportWebVitals from './reportWebVitals';\n\nReactDOM.render(\n \n \n ,\n document.getElementById('root')\n);\n\n// If you want to start measuring performance in your app, pass a function\n// to log results (for example: reportWebVitals(console.log))\n// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals\nreportWebVitals();\n"],"sourceRoot":""}