()
| 99 | |
| 100 | // The main app. |
| 101 | const App = () => { |
| 102 | // Initialize the (memoized) TinyBase store and persist it. |
| 103 | const store = useCreateStore(createStore); |
| 104 | useAndStartPersister(store); |
| 105 | |
| 106 | return ( |
| 107 | // Wrap the app in TinyBase context, so the store is default throughout and |
| 108 | // a SafeAreaProvider/SafeAreaView so it fits the screen. |
| 109 | <Provider store={store}> |
| 110 | <SafeAreaProvider> |
| 111 | <SafeAreaView style={styles.container}> |
| 112 | <Text style={styles.heading}>TinyBase Example</Text> |
| 113 | <NewTodo /> |
| 114 | <Todos /> |
| 115 | <ClearTodos /> |
| 116 | </SafeAreaView> |
| 117 | </SafeAreaProvider> |
| 118 | </Provider> |
| 119 | ); |
| 120 | }; |
| 121 | |
| 122 | const useAndStartPersister = (store) => |
| 123 | // Persist store to Expo SQLite or local storage; load once, then auto-save. |
nothing calls this directly
no test coverage detected