AVAILABLE: React Hook & Component

Native React Hook & Wrapper Component for Single-Page Applications

Integrate Rajlav AI seamlessly into modern React applications. Utilize clean TypeScript interfaces, declarative props, and custom trigger hooks for single-page apps (SPAs).

Method: React Hook / Client Component Wrapper•Verified React Component & Script Integration
React Component Wrapper ExampleAsynchronous • Zero Render Blocking
import { useEffect } from 'react';

export function SmartConnectWidget({ businessId }: { businessId: string }) {
  useEffect(() => {
    const script = document.createElement('script');
    script.src = 'https://staging.rajlav.co.in/widget/smart-connect.js';
    script.setAttribute('data-business-id', businessId);
    script.setAttribute('data-position', 'bottom-right');
    script.async = true;
    document.body.appendChild(script);

    return () => {
      document.body.removeChild(script);
    };
  }, [businessId]);

  return null;
}
Why Integrate Rajlav AI

Engineered for Performance & Scalability

01

TypeScript First

Complete TypeScript definitions for widget events, state callbacks, and configuration props.

02

Declarative State

Control widget visibility, open/closed drawer state, and user context via React props.

03

Zero Re-Render Overhead

Carefully isolated from your React virtual DOM tree to avoid unnecessary component re-renders.

04

Custom Open Hooks

Trigger the chat window programmatically from any custom button using `useSmartConnect()`.

Quickstart Guide

How to Connect React in 4 Steps

01

Add Script or Component

Include the lightweight script loader component in your React root layout or App component.

02

Pass Business ID Prop

Configure your verified Rajlav AI Business ID and position preferences.

03

Inject User Context (Optional)

Pass logged-in user details (email, user ID) to associate chats with customer accounts.

04

Build & Deploy

Works seamlessly with Vite, Create React App, Webpack, and modern bundlers.

Compatibility Matrix

Compatible Rajlav AI Modules

✓ Smart Connect Widget✓ AI Website Chatbot✓ Lead Qualification✓ Unified CRM Inbox✓ REST API & Webhooks
Integration Support

Frequently Asked Questions

Does this work with client-side routers like React Router?

Yes! The widget persists across client-side page transitions without re-initializing or losing conversation state.

Can I pass custom user data from my React state?

Yes! You can attach custom metadata (e.g. current subscription tier, customer ID) via window-level configuration before widget boot.

Is the component compatible with React 18 and 19?

Yes! Fully compatible with React 18, 19, and concurrent rendering.