feat: Added search and replace to Super notes on web/desktop. Press Ctrl+F in a super note to toggle search. (skip e2e) (#2128)
This commit is contained in:
11
packages/web/src/javascripts/Hooks/useStateRef.ts
Normal file
11
packages/web/src/javascripts/Hooks/useStateRef.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
import { useRef, useLayoutEffect, MutableRefObject } from 'react'
|
||||
|
||||
export function useStateRef<State>(state: State): MutableRefObject<State> {
|
||||
const ref = useRef<State>(state)
|
||||
|
||||
useLayoutEffect(() => {
|
||||
ref.current = state
|
||||
}, [state])
|
||||
|
||||
return ref
|
||||
}
|
||||
Reference in New Issue
Block a user