forked from pubkey/rxdb
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApp.js
More file actions
30 lines (25 loc) · 675 Bytes
/
App.js
File metadata and controls
30 lines (25 loc) · 675 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import './shim';
import 'react-native-get-random-values';
import React, {useEffect, useState} from 'react';
import { RxDatabaseProvider } from 'rxdb/plugins/react';
import Heroes from './Heroes';
import initializeDb from './initializeDb';
export const App = () => {
const [db, setDb] = useState(null);
useEffect(() => {
const initDB = async () => {
const _db = await initializeDb(true);
setDb(_db);
};
initDB();
}, []);
if (db == null) {
return null;
}
return (
<RxDatabaseProvider database={ db }>
<Heroes />
</RxDatabaseProvider>
);
};
export default App;