Verdocs Logo
Developer Center
Follow @verdocs
Visit Verdocs.com Open App

Browser Example

Verdocs JS SDK functions generally have self-explanatory names. Simply import the functions you need, and call them with the appropriate parameters. The example below displays a list of templates in the related account. Note that in this use-case, we assume the user has already authenticated via another view within the app.

import {useEffect, useState} from 'react';
import {VerdocsEndpoint, getTemplates} from '@verdocs/js-sdk';

export const TemplateList = () => {
  // NOTE: React Query or RTK Query are highly recommended!
  const [templates, setTemplates] = useState([]);
  useEffect(() => {
    getTemplates(VerdocsEndpoint.getDefault()).then(setTemplates);
  }, []);
   
  return (
    <div className="flex flex-col gap-2">
      {templates.map(template => (
        <div key={template.id} className="flex flex-row gap-4">
          <div>{template.id}</div>
          <div>{template.name}</div>
        </div>
      ))}
    </div>
   );
};