Build Violet into your React Web App

This reference documents how to install and utilize a pre-built SDK into Violet’s API. You can directly import every object and method available in Violet’s browser-side JavaScript library to source products and power embedded checkout.

Including Violet.js

You can use npm to install the Violet.js module in your react packages.

Text
npm install @violetio/violet-js

Initializing Violet.js

To initialize Violet.js, you can call . This function points the API calls made by the module to your backend server which forward requests to Violet. For example:

Text
import { initializeVioletjs } from '@violetio/violet-js';

initializeVioletjs('[BASE_PATH_TO_YOUR_SERVER]');

Sample calls

The Violet Demo App showcases how to initialize and use Violet.js. Please refer to that documentation for details.