guide pages (why was that so easy wtf)

This commit is contained in:
itsMapleLeaf
2023-03-12 15:58:47 -05:00
parent bece6c42fc
commit 6da6008d2c
21 changed files with 606 additions and 6 deletions

View File

@@ -0,0 +1,26 @@
---
title: useInstance
description: Using useInstance to get the current instance within a component
slug: use-instance
---
# useInstance
You can use `useInstance` to get the current [instance](/guides/sending-messages) within a component. This can be used to let a component destroy or deactivate itself.
```jsx
import { Button, useInstance } from "reacord"
function SelfDestruct() {
const instance = useInstance()
return (
<Button
style="danger"
label="delete this"
onClick={() => instance.destroy()}
/>
)
}
reacord.send(channelId, <SelfDestruct />)
```