TypeScript Usage
Use stores in React Native with the useStore hook.
useStore Hook
The useStore hook provides a useState-like API for accessing shared state. It requires a selector function to subscribe to a specific slice of state. The component only re-renders when the selected value changes.
Updating State
Partial Update
Pass an object with the properties to update:
Callback Update
Use a callback to access the previous state:
Nested Updates
For nested objects, spread the previous value:
Full Example
Low-Level API
For advanced use cases, you can use the core functions directly:
Type Safety
The store key is fully typed based on your BrownieStores interface:
