From 7d78bf4d2111af87636069ee2d35d6323ffc96be Mon Sep 17 00:00:00 2001 From: Jan Tuomi Date: Sat, 5 Feb 2022 15:18:48 +0200 Subject: Get stuff running --- src/App.tsx | 69 +++++++++++++++++++++++++++++-------------------------------- 1 file changed, 33 insertions(+), 36 deletions(-) (limited to 'src/App.tsx') diff --git a/src/App.tsx b/src/App.tsx index 3d9bd71..5645dcc 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,43 +1,40 @@ -import { useState } from 'react' -import logo from './logo.svg' -import './App.css' +import { useSnippets } from "./api" +import styles from "./App.module.css" +import icon from "./favicon.png" -function App() { - const [count, setCount] = useState(0) +const App = () => { + const snippets = useSnippets() + + const renderSnippets = () => { + if (snippets.type === "failed") { + return
+ Unexpected error loading snippets. See console for details. +
+ } + + if (snippets.type === "loading") { + return
Loading snippets...
+ } + + return snippets.data.map((snippet) => +
{snippet.title}
, + ) + } return ( -
-
- logo -

Hello Vite + React!

-

- -

-

- Edit App.tsx and save to test HMR updates. -

-

- - Learn React - - {' | '} - - Vite Docs - -

+
+
+
+ + SLAM +
+
+ A Mere Stack Language +
+
+ {renderSnippets()} +
) } -- cgit v1.3