refactor: rendering button
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
import * as React from "react"
|
||||
import { Button } from "../src/main.js"
|
||||
import { Button } from "../src.new/components/button.js"
|
||||
|
||||
export function Counter() {
|
||||
const [count, setCount] = React.useState(0)
|
||||
return (
|
||||
<>
|
||||
this button was clicked {count} times
|
||||
<Button onClick={() => setCount(count + 1)}>clicc</Button>
|
||||
<Button label="clicc" onClick={() => setCount(count + 1)} />
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
import { Client } from "discord.js"
|
||||
import "dotenv/config"
|
||||
import React from "react"
|
||||
import { InstanceManager } from "../src.new/main.js"
|
||||
import { createCommandHandler } from "./command-handler.js"
|
||||
import { Counter } from "./counter.js"
|
||||
|
||||
const client = new Client({
|
||||
intents: ["GUILDS"],
|
||||
@@ -14,7 +16,7 @@ createCommandHandler(client, [
|
||||
name: "counter",
|
||||
description: "shows a counter button",
|
||||
run: (interaction) => {
|
||||
manager.create(interaction).render("hi world")
|
||||
manager.create(interaction).render(<Counter />)
|
||||
},
|
||||
},
|
||||
])
|
||||
|
||||
Reference in New Issue
Block a user