Skip to content

Commit 528a78d

Browse files
committed
fix(docs): replace useCursor hook implementation
Replace context-based useCursor hook with local state implementation to resolve SSG build issues while preserving cursor functionality.
1 parent 0bac513 commit 528a78d

1 file changed

Lines changed: 10 additions & 25 deletions

File tree

Lines changed: 10 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,16 @@
1-
import React, { createContext, useContext, useState, ReactNode } from 'react';
2-
3-
interface CursorContextType {
4-
isHovered: boolean;
5-
setIsHovered: (hovered: boolean) => void;
6-
}
7-
8-
const CursorContext = createContext<CursorContextType | undefined>(undefined);
1+
import React, { ReactNode, useState } from 'react';
92

3+
// Simple wrapper component that maintains children without context
104
export function CursorProvider({ children }: { children: ReactNode }) {
11-
const [isHovered, setIsHovered] = useState(false);
12-
13-
return (
14-
<CursorContext.Provider value={{ isHovered, setIsHovered }}>{children}</CursorContext.Provider>
15-
);
5+
return <>{children}</>;
166
}
177

8+
// Standalone hook that manages cursor state locally without context
189
export function useCursor() {
19-
const context = useContext(CursorContext);
20-
21-
// Always return a safe default if context is undefined
22-
// This handles both SSR and cases where CursorProvider is not available
23-
if (context === undefined) {
24-
return {
25-
isHovered: false,
26-
setIsHovered: () => {}
27-
};
28-
}
29-
30-
return context;
10+
const [isHovered, setIsHovered] = useState(false);
11+
12+
return {
13+
isHovered,
14+
setIsHovered
15+
};
3116
}

0 commit comments

Comments
 (0)