Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/dailydotdev/apps
/ usePrevious
Function
usePrevious
packages/shared/src/hooks/usePrevious.ts:3–9 ·
view source on GitHub ↗
(value: T)
Source
from the content-addressed store, hash-verified
1
import
React, { useEffect } from
'react'
;
2
3
export
const
usePrevious = <T>(value: T): T | undefined => {
4
const
ref = React.useRef<T>();
5
useEffect(() => {
6
ref.current = value;
7
});
8
return
ref.current;
9
};
Callers
4
Dropdown
Function · 0.90
PostReferrerContext.tsx
File · 0.90
ActiveFeedNameContextProvider
Function · 0.90
setUp
Function · 0.85
Calls
no outgoing calls
Tested by
1
setUp
Function · 0.68