Files
tom goriunovandGitHub b9b3733ef3 Page meta tags are not generated on the server (#2731)
* Page meta tags are not generated on the server

Fixes #2730

* suppress warnings about critical dependencies in Next.js logs
2025-05-15 18:24:55 +02:00

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 ]);
}