Recommendation container can work automatically or you can pass document id to get the recommendation list for the document

import { LablebRecommend } from '@lableb/react-sdk';

<LablebRecommend automatic={true} />

// or

<LablebRecommend id={documentId}/>
// at some point `documentId` is set by your app logic


We create a state for the current selected item, then use that state to update the recommendation for our users based on user selection, LablebRecommend will automatically re-render when selectedItem get updated, providing instant recommendation for our users.

function App() {

  const [selectedDocument, setSelectedDocument] = useState<any>({});

  return (
    <LablebProvider options={options}>

      <LablebSearch />

        onDocumentClick={(doc) => setSelectedDocument(doc)}

      <LablebRecommend id={selectedDocument?.id} />