Bluesky app fork with some witchin' additions 馃挮
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

at main 20 lines 700 B view raw
1import {useInsertionEffect, useRef} from 'react' 2 3/** 4 * This should be used sparingly. It erases reactivity, i.e. when the inputs 5 * change, the returned object itself will remain the same. This means that if 6 * you use this at a higher level of your tree, and then some state you read in 7 * it changes, there is no mechanism for anything below in the tree to "react" 8 * to this change (e.g. by knowing to call your function again). 9 * 10 * For callbacks, see `useNonReactiveCallback` instead. 11 */ 12export function useNonReactiveObject<T extends Record<string, unknown>>( 13 o: T, 14): React.RefObject<T> { 15 const ref = useRef(o) 16 useInsertionEffect(() => { 17 ref.current = o 18 }, [o]) 19 return ref 20}