-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathApp.js
43 lines (39 loc) · 1.37 KB
/
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
import React from "react";
import { BrowserRouter } from "react-router-dom";
import { AppRoutes } from "./routes/AppRoutes";
import { MainLayout } from "./components/layout/MainLayout/MainLayout";
import { Header } from "./components/layout/Header/Header";
import { StyledApp } from "./App.styled";
import { ThemeProvider } from "styled-components";
import { theme } from "./styles/Theme";
import { GlobalStyle } from "./styles/globalStyles";
import { useState, useEffect } from "react";
import { TransactionsListContext } from "./services/context/TransactionsListContext";
import transactionService from "./services/api/transactionsService.";
const App = () => {
const [transactionsList, setTransactionsList] = useState([]);
useEffect(async () => {
const transactionsList = await transactionService.getTransactionList();
setTransactionsList(transactionsList);
}, []);
return (
<>
<ThemeProvider theme={theme}>
<GlobalStyle />
<StyledApp>
<BrowserRouter>
<Header />
<TransactionsListContext.Provider
value={{ transactionsList, setTransactionsList }}
>
<MainLayout>
<AppRoutes />
</MainLayout>
</TransactionsListContext.Provider>
</BrowserRouter>
</StyledApp>
</ThemeProvider>
</>
);
};
export default App;