Optional configuration accepted by useAtom
A selector function to be applied to the internal state of the Atom to compute the return value of useAtom.
If the selector is known to be an expensive computation, you should consider passing a referentially stable, memoized version of the function.
import { Atom, useAtom } from '@dbeining/react-atom' import { Orders } from 'elsewhere' const stateAtom = Atom.of({ orders: [...Orders] }) function MyComponent() { const orderCount = useAtom(stateAtom, { select: (s) => s.orders.length }) return <p>There are {orderCount} orders</p> }
Optional configuration accepted by useAtom