Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-djs

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-djs

A discord.js renderer for React.

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

react-djs

A discord.js renderer for React. This forks a lot of content from another React library called Reacord, but has the following advantages:

  • It is much closer coupled to discord.js. This is better because you can get the message object and await the message reply so you know it got delivered.
  • It is a significantly smaller codebase with less abstractions in general. The 3 main abstractions in the codebase are the render manager, the message renderer, and the React renderer (takes the React content and passes it to the message renderer).
  • It doesn't break with ephemeral messages. I tried to fix this in Reacord, but found the codebase hard to navigate around.
  • It automatically garbage collects!

Usage

To use react-djs, you first want to create a RenderManager with the client. You only want to do this once per instance:

export const renderManager = new RenderManager(client);

From here, we can use either use create:

const message = await renderManager.create(channel, <MyAwesomeComponent name="Jeff" />);

Or we can use reply:

// For messages:
const message = await renderManager.reply(msg, <MyAwesomeComponent />);

// For interactions:
const message = await renderManager.reply(interaction, <MyAwesomeComponent />);

// For interactions (ephemeral):
const message = await renderManager.reply(interaction, <MyAwesomeComponent />, { ephemeral: true });

You can then use the components within the library to build your application!

FAQs

Package last updated on 11 Mar 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc