mirror of
https://github.com/luxfi/explore.git
synced 2026-09-24 00:28:18 +00:00
* Page meta tags are not generated on the server Fixes #2730 * suppress warnings about critical dependencies in Next.js logs
21 lines
548 B
TypeScript
21 lines
548 B
TypeScript
import type { GrowthBook } from '@growthbook/growthbook-react';
|
|
import React from 'react';
|
|
|
|
import { SECOND } from 'toolkit/utils/consts';
|
|
|
|
export default function useLoadFeatures(growthBook: GrowthBook | undefined) {
|
|
React.useEffect(() => {
|
|
if (!growthBook) {
|
|
return;
|
|
}
|
|
|
|
growthBook.setAttributes({
|
|
...growthBook.getAttributes(),
|
|
timezone: Intl.DateTimeFormat().resolvedOptions().timeZone,
|
|
language: window.navigator.language,
|
|
});
|
|
|
|
growthBook.loadFeatures({ timeout: SECOND });
|
|
}, [ growthBook ]);
|
|
}
|