- Refactor tests to use @testing-library/react and update dependencies - . - Refactor ESLint configuration to use modern imports and remove deprecated notes file - Update ESLint and TypeScript configurations for improved compatibility and modern syntax - Update TypeScript target and ESLint configuration for improved compatibility - Update Jest configuration, refactor tests, and add date utility function - Update ESLint configuration to include React settings and enhance rules |
||
---|---|---|
.vscode | ||
src | ||
tests | ||
.gitignore | ||
.npmrc | ||
.prettierrc | ||
LICENSE | ||
README.md | ||
eslint.config.mjs | ||
jestconfig.json | ||
package-lock.json | ||
package.json | ||
tsconfig.json |
README.md
Tuitio Client React
Introduction
Tuitio Client React is an npm package written in TypeScript that simplifies the integration of a React application with Tuitio.
This package builds upon tuitio-client by adding state management via React Context and providing various hooks for seamless access to data and actions.
Installation
Install the package using npm:
npm install @flare/tuitio-client-react --registry https://lab.code-rove.com/public-node-registry
Alternatively, add it directly to your package.json
file:
"dependencies": {
"@flare/tuitio-client-react": "1.0.0"
}
Usage
Importing the package
Using CommonJS:
const {
TuitioProvider,
useTuitioClient,
useTuitioUser,
useTuitioToken,
useTuitioUserInfo
} = require("@flare/tuitio-client-react");
Using ES Modules:
import {
TuitioProvider,
useTuitioClient,
useTuitioUser,
useTuitioToken,
useTuitioUserInfo
} from "@flare/tuitio-client-react";
Example usage
Wrap your application with TuitioProvider
:
import { TuitioProvider } from "@flare/tuitio-client-react";
function App() {
return (
<TuitioProvider>
<YourComponent />
</TuitioProvider>
);
}
Access Tuitio services via hooks:
import { useTuitioUser, useTuitioToken } from "@flare/tuitio-client-react";
function UserProfile() {
const user = useTuitioUser();
const token = useTuitioToken();
return (
<div>
<h1>Welcome, {user.name}</h1>
<p>Your token: {token}</p>
</div>
);
}
Unit testing
Unit tests are written using Jest.
-
Test files follow the naming convention
*.test.ts
. -
Run all tests with:
npm test
Changelog
1.3.0
- Migrated from
@flare/js-utils
to@flare/utiliyo
. - Upgraded dependencies to their latest versions.
- Refactored codebase to use ES6 modules and syntax.
1.2.x
- 1.2.10 - Upgraded
@flare/tuitio-client
. - 1.2.9 - Upgraded
@flare/tuitio-client
. - 1.2.8 - Included the
src
directory in the npm package. - 1.2.7 - Set React version range in peer dependencies.
- 1.2.6 - Removed hardcoded user groups and roles; records are now dynamic.
- 1.2.5 - Upgraded
@flare/tuitio-client
. - 1.2.4 - Upgraded
@flare/tuitio-client
. - 1.2.3 - Handled user roles in
useTuitioUserInfo
hook. - 1.2.2 - Upgraded
@flare/tuitio-client
and@flare/js-utils
. - 1.2.1 - Added
decodedToken
inuseTuitioToken
hook. - 1.2.0 - Implemented
user-info
method from Tuitio API.
1.1.x
- 1.1.1 - Fixed account logout bug.
- 1.1.0 - Implemented account logout and latest Tuitio API changes.
1.0.x
- 1.0.1 - Added default options for
useTuitioClient
. - 1.0.0 - Initial package release.
For further details, contributions, or issue reporting, visit the repository.