Skip to content

dialectlabs/react

Repository files navigation

Dialect React SDK & UI 💬

react-sdk npm npm

React components to use Dialect's wallet alerts.

Want to learn how to add Dialect to your dapp? See our Docs.

Table of Contents

Installation

npm:

npm install @dialectlabs/react-ui --save

npm install @dialectlabs/react-sdk-blockchain-solana --save

yarn:

yarn add @dialectlabs/react-ui

yarn add @dialectlabs/react-sdk-blockchain-solana

Development

Prerequisites

  • Git
  • yarn 1
  • Nodejs (>=18)

Get Started

This repo utilizes Workspaces. Publishable packages are located under packages directory. examples directory contains apps to demonstrate how can Dialect be used.

The simplest way to develop on Dialect's component library and headless react contexts locally is to run one of the demo apps in the examples/ directory, and ensure you are targeting the local instances of packages/react-sdk, packages/react-ui and packages/react-sdk-blockchain-solana. How to best do this is described below.

Once set up, you'll have live, hot-reloading on changes. Some manual configuration is required to enable this.

Enable hot-reloading from an examples/ app

Choose one of the examples/ apps you'd like to do development from and then make the following changes in its source. For illustration purposes we choose examples/notifications-solana.

For example you want to make changes in react-ui library

Run

yarn run dev:react-ui

All of the above changes require restarting the next server and clearing cache (just in case), if you've already started it.

You can now run the example by following the instructions in the next section.

Start the examples

To get started, launch example's next dev server:

yarn install # in root dir
cd examples/notifications-solana
yarn run dev

Now you have a hot reload of the packages in the workspace.

Publishing

yarn run build:all
pushd packages/react-sdk/
npm publish --access public
popd
pushd packages/react-sdk-blockchain-solana/
npm publish --access public
popd
pushd packages/react-ui/
npm publish --access public
popd
  1. Update all versions of packages to the new one(e.g. bump react, react-ui version in examples, starters folder)

This project is tested with BrowserStack.