Search...
A React Hook that create a gettable ref, a function way to get the latest value of a ref.
Try to increase the counter and then toast the latest ref value.
NOTE: Changes in the ref value will not trigger a re-render, you should call render to update the UI.
render
See API for more details.
Click links below to view source on GitHub.
const [ref, getter] = useGetterRef(initialValue)
Initial value of the ref.
export type UseGetterRefReturns<T> = [ /** * A mutable ref object that can be used to store a value. */ ref: React.MutableRefObject<T>, /** * A getter function that returns the current value of the ref. */ getter: () => T, ]