Skip to content

Commit

Permalink
update usePrevious hook
Browse files Browse the repository at this point in the history
  • Loading branch information
edelgarat committed Mar 14, 2024
1 parent 8aa7f9b commit ee0ff26
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 64 deletions.
120 changes: 60 additions & 60 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@worksolutions/react-utils",
"private": false,
"version": "2.2.2",
"version": "2.2.3",
"description": "",
"types": "dist/esm/index.d.ts",
"main": "dist/cjs/index.js",
Expand Down
4 changes: 1 addition & 3 deletions src/hooks/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ export function useEffectSkipFirst(callback: React.EffectCallback, dependencies?

export function usePrevious<T>(value: T) {
const ref = useRef<T>(value);
useEffect(() => {
ref.current = value;
}, [value]);
useMemo(() => void (ref.current = value), [value]);
return ref.current;
}

0 comments on commit ee0ff26

Please sign in to comment.