In the Statsig React SDK, you can use the initCompletionCallback
option during the SDK initialization to verify if the initialization was successful within a specified timeframe. This callback is invoked when the initialization process is completed. It provides three parameters: initDurationMs
, success
, and message
.
If the initialization was not successful within the specified timeframe, the success
parameter would be false
and the message
parameter would provide additional information.
Here's an example of how to use it:
javascript statsig.initialize('<CLIENT_SDK_KEY>', user, { initCompletionCallback: (initDurationMs, success, message) => { if (success) { console.log('Statsig has been initialized successfully.'); } else { console.log('Statsig initialization failed:', message); } }, });
Please note that this option is supported in v4.13.0+ of the JavaScript SDK. For more information, you can refer to the Statsig JavaScript SDK documentation under Options.