-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prevent amplitude import in server-side rendering environment #212
Comments
요런식으로 하면 돼요!
|
@milooy 제가 가져가서 한번 해볼게요. 저희 프로젝트에 SSR 판단하는 util 함수가 존재하는데, 그거 사용해서 해보겠슴당~ |
@milooy +) 추가적으로 initialize 함수에 console.warn 출력해주고, amplitude SSR 관련 문서 혹은 핸드북 링크 걸어주면 좋을 것 같습니다. SSR에서 사용할 거면 다른 방식 사용 유도를 위해서요. import amplitude, {AmplitudeClient, Config} from 'amplitude-js';
export const initialize = (
apiKey: string,
userId?: string,
config?: Config,
callback?: (client: AmplitudeClient) => void,
) => {
// eslint-disable-next-line import/no-named-as-default-member
amplitude.getInstance().init(apiKey, userId, config, callback);
}; |
제가 첨부한 코드는 위에서 useEffect만 빼도 되지 않을까요? |
위 언급된 코드에 Fix 올렸습니다~ |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
문제
해결책
The text was updated successfully, but these errors were encountered: