-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.js
44 lines (38 loc) · 1018 Bytes
/
App.js
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/**
* Sample React Native App
* https://github.com/facebook/react-native
*
* @format
* @flow strict-local
*/
import React from 'react';
import AppNavigator from './src/navigation';
import {StyleSheet, View} from 'react-native';
import axios from 'axios';
import {Provider} from 'react-redux';
import {applyMiddleware, createStore} from 'redux';
import axiosMiddleware from 'redux-axios-middleware';
import reducer from './src/store/reducer';
// axios api client
const client = axios.create({
baseURL: 'https://reqres.in/api',
responseType: 'json',
});
// initializes axios api client with axiosMiddleware and create redux store with reducer.
const store = createStore(reducer, applyMiddleware(axiosMiddleware(client)));
const App = () => {
return (
<Provider store={store}>
<View style={styles.container}>
<AppNavigator />
</View>
</Provider>
);
};
export default App;
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff',
},
});