(ref: AtomRef.ReadonlyRef<A>)
| 435 | * @since 4.0.0 |
| 436 | */ |
| 437 | export const useAtomRef = <A>(ref: AtomRef.ReadonlyRef<A>): A => { |
| 438 | const [, setValue] = React.useState(ref.value) |
| 439 | React.useEffect(() => ref.subscribe(setValue), [ref]) |
| 440 | return ref.value |
| 441 | } |
| 442 | |
| 443 | /** |
| 444 | * Returns a memoized atom ref for a property of another atom ref. |
no test coverage detected