We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 559aa8d commit 4726feaCopy full SHA for 4726fea
packages/browser/src/index.ts
@@ -1,14 +1,15 @@
1
+'use client';
2
import { createUseFunnel } from '@use-funnel/core';
3
import { useEffect, useMemo, useState } from 'react';
4
5
export * from '@use-funnel/core';
6
7
export const useFunnel = createUseFunnel(({ id, initialState }) => {
8
const [location, setLocation] = useState(() => ({
- search: window.location.search,
9
+ search: typeof window !== 'undefined' ? window.location.search : '',
10
}));
11
const [state, setState] = useState(() => ({
- ...window.history.state,
12
+ ...(typeof window !== 'undefined' ? window.history.state : {}),
13
14
15
useEffect(() => {
0 commit comments