-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a35b3d9
commit eaefc9a
Showing
2 changed files
with
143 additions
and
1 deletion.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,30 @@ | ||
import { useState } from "preact/hooks"; | ||
import { Button } from "../components/Button.tsx"; | ||
// import fs from 'fs' | ||
|
||
interface CounterProps { | ||
start: number; | ||
} | ||
|
||
export default function Counter(props: CounterProps) { | ||
export default function Counter(props: CounterProps) { | ||
const [count, setCount] = useState(props.start); | ||
|
||
const testJsonFile = async () => { | ||
const file1 = await Deno.open("../data/lu.json", { read: true }); | ||
|
||
// let dataArray = JSON.parse(file1.read()) | ||
console.log(file1) | ||
|
||
} | ||
|
||
|
||
return ( | ||
<div class="flex gap-2 w-full"> | ||
<p class="flex-grow-1 font-bold text-xl">{count}</p> | ||
<Button onClick={() => setCount(count - 1)}>-1</Button> | ||
<Button onClick={() => setCount(count + 1)}>+1</Button> | ||
<Button onClick={testJsonFile}>test </Button> | ||
|
||
</div> | ||
); | ||
} |