useInit

The purpose of useInit hook is to initialise the SDK as an alternative to init JS API. Internally it uses init JS API, creates a new user profile if no user profile token is passed or reuses existing user profile in case a user token is passed.

Example usage
const { profile, loaded } = useInit({
  clientId: '<Client ID>',
});

Hook argument

📘

JS API init args reference

Both, JS API init and useInit hook use the same argument details.
Browse our init args description in case you need to understand useInit args.

Hook Return Value

profile

Type

Default

IUserProfile

null

loaded

Type

Default

boolean

false


What’s Next