add link to template + other tweaks
This commit is contained in:
@@ -7,11 +7,15 @@ meta:
|
|||||||
|
|
||||||
# Getting Started
|
# Getting Started
|
||||||
|
|
||||||
This guide assumes some familiarity with JavaScript, [React](https://reactjs.org), [Discord.js](https://discord.js.org) and the [Discord API](https://discord.dev). Keep these pages as reference if you need it.
|
These guides assume some familiarity with JavaScript, [React](https://reactjs.org), [Discord.js](https://discord.js.org) and the [Discord API](https://discord.dev). Keep these pages as reference if you need it.
|
||||||
|
|
||||||
**Note:** Ensure your project has support for running code with JSX. I recommend using [esno](https://npm.im/esno).
|
## Setup from template
|
||||||
|
|
||||||
## Install
|
[Use this starter template](https://github.com/itsMapleLeaf/reacord-starter) to get off the ground quickly.
|
||||||
|
|
||||||
|
## Adding to an existing project
|
||||||
|
|
||||||
|
Install Reacord and dependencies:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# npm
|
# npm
|
||||||
@@ -24,12 +28,10 @@ yarn add reacord react discord.js
|
|||||||
pnpm add reacord react discord.js
|
pnpm add reacord react discord.js
|
||||||
```
|
```
|
||||||
|
|
||||||
## Setup
|
|
||||||
|
|
||||||
Create a Discord.js client and a Reacord instance:
|
Create a Discord.js client and a Reacord instance:
|
||||||
|
|
||||||
```js
|
```js
|
||||||
// main.js
|
// main.jsx
|
||||||
import { Client } from "discord.js"
|
import { Client } from "discord.js"
|
||||||
import { ReacordDiscordJs } from "reacord"
|
import { ReacordDiscordJs } from "reacord"
|
||||||
|
|
||||||
@@ -42,3 +44,10 @@ client.on("ready", () => {
|
|||||||
|
|
||||||
await client.login(process.env.BOT_TOKEN)
|
await client.login(process.env.BOT_TOKEN)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
To use JSX in your code, run it with [tsx](https://npm.im/tsx):
|
||||||
|
|
||||||
|
```bash
|
||||||
|
npm install tsx
|
||||||
|
tsx main.tsx
|
||||||
|
```
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
---
|
---
|
||||||
|
order: 5
|
||||||
meta:
|
meta:
|
||||||
title: useInstance
|
title: useInstance
|
||||||
description: Using useInstance to get the current instance within a component
|
description: Using useInstance to get the current instance within a component
|
||||||
|
|||||||
Reference in New Issue
Block a user