userbased-react
v1.0.2
Published
## Install the SDK
Downloads
2
Readme
UserbasedJS
Install the SDK
with npm
npm i userbased-react --save
with yarn
yarn add userbased-react
Using the Provider
Once you have initialized the Userbased
SDK with userbased.init(API_KEY, {})
, pass it to the <UserbasedProvider client={...}>
component.
import { UserbasedProvider } from 'userbased-react';
<UserbasedProvider client={userbased}>
{children}
</UserbasedProvider>
Using the Hook
Once you have wrapped your app with the <UserbasedProvider>
component, you can access the context object using the useUserbased()
hook. This allows you to use the identify()
method.
import { useUserbased } from 'userbased-react';
export const ExampleApp = () => {
const Userbased = useUserbased();
const {session} = useSession();
useEffect(() => {
Userbased.identify(session.user.email)
},[])
return {
...
}
}