0.1.12 • Published 4 months ago

@yoctotta/kaman v0.1.12

Weekly downloads
-
License
-
Repository
-
Last release
4 months ago

@yoctotta/kaman

A React component library for the Kaman Frontend Microservice.

Installation

npm install @yoctotta/kaman
# or
yarn add @yoctotta/kaman

# Required peer dependencies
npm install react react-dom react-icons recharts lucide-react ace-builds react-ace
# or
yarn add react react-dom react-icons recharts lucide-react ace-builds react-ace

Usage

import { KamanExportComponent } from '@yoctotta/kaman';
// Import the CSS (important!)
import '@yoctotta/kaman/dist/kaman.css';

function App() {
  return (
    <KamanExportComponent 
      initialApplicationIndex={0}
      initialExpertIndex={0}
      userObj={{/* your user object */}}
      token="your-auth-token"
    />
  );
}

Styling

This library uses Tailwind CSS with a km- prefix to avoid conflicts with your application's styles. Make sure to import the CSS file:

import '@yoctotta/kaman/dist/kaman.css';

Troubleshooting

React Version Conflicts

If you encounter errors like "cannot read properties of null reading useState", you likely have multiple versions of React in your application.

To fix this: 1. Ensure you have only one version of React in your project 2. Check yarn why react or npm ls react for duplicates 3. If you see multiple versions, update your dependencies or use yarn's resolutions to force a single version

// In your package.json
"resolutions": {
  "react": "18.2.0",
  "react-dom": "18.2.0"
}

Props

PropTypeDefaultDescription
initialApplicationIndexnumber0Initial application index to display
initialExpertIndexnumber0Initial expert index to display
userObjObjectrequiredUser object for authentication
tokenstringrequiredAuth token for API calls