diff --git a/readme.md b/readme.md index 03d7f8d..2fd43ba 100644 --- a/readme.md +++ b/readme.md @@ -22,23 +22,19 @@ this frontend app: 1. fetches data from a server 1. if ok, render items in a list. if error, render error span at the bottom of the page. - - - - - - - - - - - -
ReactHalogen
+
+React (click to expand) -```javascript -export const App = () => { - const [items, setItems] = React.useState(undefined) - const [error, setError] = React.useState(undefined) +```typescript +type Item = {id: string, title: string, description: string} + +export const App: () => React.Node = () => { + const [items, setItems] = React.useState | undefined>(undefined) + const [error, setError] = React.useState(undefined) React.useEffect(() => { fetch('/api/item') - .then(rep => rep.json()) + .then(rep => rep.json>()) .then(items => setItems(items)) .catch(e => setError(e)) }, []) @@ -60,8 +56,10 @@ export const App = () => { } ``` -
+ + +
+Purescript Halogen (click to expand) ```haskell type Item = { id :: String @@ -106,7 +104,4 @@ app = mkComponent } ``` -
+