Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
seveibar committed Jun 4, 2024
1 parent 887c724 commit a2d9bd4
Show file tree
Hide file tree
Showing 5 changed files with 158 additions and 31 deletions.
151 changes: 122 additions & 29 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
},
"dependencies": {
"react": "^18.2.0",
"react-dom": "^18.2.0"
"react-dom": "^18.2.0",
"react-query": "^3.39.3"
},
"devDependencies": {
"@biomejs/biome": "^1.8.0",
Expand Down
14 changes: 14 additions & 0 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
import { useQuery } from "react-query"

function App() {
const { data, error, isLoading } = useQuery("kicadFiles", async () => {

Check failure on line 4 in src/App.tsx

View workflow job for this annotation

GitHub Actions / build

'data' is declared but its value is never read.
const response = await fetch(
"https://kicad-mod-cache.tscircuit.com/kicad_files.json"
)
if (!response.ok) {
throw new Error("Network response was not ok")
}
return response.json()
})

if (isLoading) return <div>Loading...</div>
if (error) return <div>Error: {(error as Error).message}</div>
return (
<div className="flex flex-col min-h-screen">
<header className="p-4">
Expand Down
16 changes: 16 additions & 0 deletions src/ContextProviders.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { QueryClient, QueryClientProvider } from "react-query"
import type { ReactNode } from "react"

const queryClient = new QueryClient()

interface Props {
children: ReactNode
}

const ContextProviders = ({ children }: Props) => {
return (
<QueryClientProvider client={queryClient}>{children}</QueryClientProvider>
)
}

export default ContextProviders
5 changes: 4 additions & 1 deletion src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@ import React from "react"
import ReactDOM from "react-dom/client"
import App from "./App.tsx"
import "./index.css"
import ContextProviders from "./ContextProviders"

ReactDOM.createRoot(document.getElementById("root") as HTMLElement).render(
<React.StrictMode>
<App />
<ContextProviders>
<App />
</ContextProviders>
</React.StrictMode>
)

0 comments on commit a2d9bd4

Please sign in to comment.