npm.io
2.1.5 • Published 8 months ago

lumapps-sdk-js

Licence
MIT
Version
2.1.5
Deps
2
Size
236 kB
Vulns
0
Weekly
0

LumApps JavaScript SDK

Tests

The Lumapps JavaScript SDK is a lightweight interface to Lumapps for your React components.

Quickstart

Install the SDK with npm:

$ npm install --save lumapps-sdk-js

Import Lumapps Hooks to use them:

import React, { FC, useMemo } from 'react';

import { useCurrentUser } from 'lumapps-sdk-js';

export const HelloWidget: FC = () => {
    const { email, fullName } = useCurrentUser();
    const { displayLanguage } = useLanguage();

    const welcomeMessage = useMemo(() => {
        return (
            <p>
                Hello {fullName}, your email is {email}.
            </p>
        );
    }, [email, fullName]);

    return (
        <>
            {welcomeMessage}
        </>
    );
};