feat: add context information to render function (#46)
This commit is contained in:
+20
-18
@@ -19,23 +19,25 @@ export default function Home() {
|
||||
|
||||
function Counter() {
|
||||
const [count, setCount] = useState(0);
|
||||
return <div class={tw`mt-4 border rounded p-4 text-center`}>
|
||||
<p class={tw`text-lg font-medium`}>Current count: {count}</p>
|
||||
<div class={tw`flex gap-2 mt-4 justify-center`}>
|
||||
<RoundedButton
|
||||
type="button"
|
||||
onClick={() => setCount(count - 1)}
|
||||
disabled={!IS_BROWSER}
|
||||
>
|
||||
<IconMinus />
|
||||
</RoundedButton>
|
||||
<RoundedButton
|
||||
type="button"
|
||||
onClick={() => setCount(count + 1)}
|
||||
disabled={!IS_BROWSER}
|
||||
>
|
||||
<IconPlus />
|
||||
</RoundedButton>
|
||||
return (
|
||||
<div class={tw`mt-4 border rounded p-4 text-center`}>
|
||||
<p class={tw`text-lg font-medium`}>Current count: {count}</p>
|
||||
<div class={tw`flex gap-2 mt-4 justify-center`}>
|
||||
<RoundedButton
|
||||
type="button"
|
||||
onClick={() => setCount(count - 1)}
|
||||
disabled={!IS_BROWSER}
|
||||
>
|
||||
<IconMinus />
|
||||
</RoundedButton>
|
||||
<RoundedButton
|
||||
type="button"
|
||||
onClick={() => setCount(count + 1)}
|
||||
disabled={!IS_BROWSER}
|
||||
>
|
||||
<IconPlus />
|
||||
</RoundedButton>
|
||||
</div>
|
||||
</div>
|
||||
</div>;
|
||||
);
|
||||
}
|
||||
|
||||
@@ -15,11 +15,13 @@ export default function ModuleInfoPage({ params }: PageProps) {
|
||||
}
|
||||
|
||||
const { latest, versions } = info;
|
||||
return <p>
|
||||
The module `{params.module}` has {versions.length} versions, with {latest}
|
||||
{" "}
|
||||
being the most recent.
|
||||
</p>;
|
||||
return (
|
||||
<p>
|
||||
The module `{params.module}` has {versions.length} versions, with {latest}
|
||||
{" "}
|
||||
being the most recent.
|
||||
</p>
|
||||
);
|
||||
}
|
||||
|
||||
interface ModuleInfo {
|
||||
|
||||
Reference in New Issue
Block a user