Fix broken linkgs. Add basic counter

This commit is contained in:
sigma-andex 2023-01-13 19:17:36 +00:00
parent 9ff766ad70
commit f2b8e19695
No known key found for this signature in database
GPG Key ID: C5F79968835855AB
3 changed files with 12 additions and 6 deletions

View File

@ -1,2 +1,3 @@
import { mkPage } from "../output/Page/index";
export default mkPage();
'use client'
import { mkPage } from '../output/Page/index'
export default mkPage()

View File

@ -12,5 +12,4 @@ mkRootLayout = do
pure $ \{ children } -> R.html {}
[ R.head { lang: "en" } React.empty
, R.body {} children
]

View File

@ -2,11 +2,17 @@ module Page where
import Prelude
import Data.Tuple.Nested ((/\))
import React.Basic.DOM.Simplified.Generated as R
import React.Basic.Events (handler_)
import React.Basic.Hooks as React
mkPage :: React.Component {}
mkPage = do
pure $ \props -> R.main {}
[ R.div {} "Hello World"
]
React.component "Page" \props -> React.do
counter /\ setCounter <- React.useState' 0
pure $ R.main {}
[ R.button { onClick: handler_ (setCounter $ counter - 1) } "-"
, R.div {} $ show counter
, R.button { onClick: handler_ (setCounter $ counter + 1) } "+"
]