modules
@dopt/react-users / Exports
@dopt/react-users
Table of contents
Interfaces
Type Aliases
Functions
Type Aliases
DoptUsersContext
Ƭ DoptUsersContext: Object
Type declaration
Name | Type |
---|---|
client | UsersApiClient |
Defined in
packages/@dopt/react-users/src/index.tsx:15
IdentifyUserRequest
Ƭ IdentifyUserRequest: Parameters
<UsersApiClient
["users"
][``"identifyUser"``]>[0
]
Defined in
packages/@dopt/react-users/src/index.tsx:66
IdentifyGroupRequest
Ƭ IdentifyGroupRequest: Parameters
<UsersApiClient
["groups"
][``"identifyGroup"``]>[0
]
Defined in
packages/@dopt/react-users/src/index.tsx:109
Functions
DoptUsersProvider
▸ DoptUsersProvider(«destructured»
): Element
A React context provider for accessing Dopt's users API.
Example
import { DoptUsersProvider } from '@dopt/react-users';
import Application from './application';
const rootElement = document.getElementById('root');
ReactDOM.render(
<DoptUsersProvider apiKey={usersApiKey}>
<Application />
</DoptProvider>,
rootElement
);
Parameters
Name | Type |
---|---|
«destructured» | DoptUserProps |
Returns
Element
Defined in
packages/@dopt/react-users/src/index.tsx:47
useIdentifyUser
▸ useIdentifyUser(request
): undefined
| string
This hook wraps @dopt/users-javascript-client
users.identifyUser
.
The first time this hook is called, it will return undefined
and
call users.identifyUser
. Once the identifyUser
call completes,
it will return the userIdentifier
.
On subsequent calls, the hook will return the previous userIdentifier
and call users.identifyUser
. Once the identifyUser
call completes,
it will return the new userIdentifier
.
Remarks
Internally, this hook uses the request
as a dependency to a useEffect
hook
which will be only be triggered when the request
reference changes.
Parameters
Name | Type | Description |
---|---|---|
request | IdentifyUserRequestBody | users.identifyUser request body, consisting of a user identifier , a properties object, and optional groups (see identifyGroup ) |
Returns
undefined
| string
the userIdentifier
string (or undefined
on initial call)
Defined in
packages/@dopt/react-users/src/index.tsx:88
useIdentifyGroup
▸ useIdentifyGroup(request
): undefined
| string
This hook wraps @dopt/users-javascript-client
groups.identifyGroup
.
The first time this hook is called, it will return undefined
and
call groups.identifyGroup
. Once the identifyGroup
call completes,
it will return the groupIdentifier
.
On subsequent calls, the hook will return the previous groupIdentifier
and call groups.identifyGroup
. Once the identifyGroup
call completes,
it will return the new groupIdentifier
.
Remarks
Internally, this hook uses the request
as a dependency to a useEffect
hook
which will be only be triggered when the request
reference changes.
Parameters
Name | Type | Description |
---|---|---|
request | IdentifyGroupRequestBody | users.identifyGroup request body, consisting of a group identifier and a properties object |
Returns
undefined
| string
the groupIdentifier
string (or undefined
on initial call)