-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.js
40 lines (34 loc) · 1.15 KB
/
index.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
import React from "react";
import ReactDOM from "react-dom";
import { Provider } from "react-redux";
import { BrowserRouter, Route, Switch } from "react-router-dom";
import { applyMiddleware, createStore } from "redux";
import promiseMiddleware from "redux-promise-middleware";
import HomePage from "./HomePage";
import Layout from "./Layout";
import VehicleDetail from "./VehicleDetail";
import VehiclesFilters from "./VehiclesFilters";
import VehiclesList from "./VehiclesList";
import reducer from "./reducers";
const store = createStore(reducer, applyMiddleware(promiseMiddleware()));
const VehiclesPage = () => (
<React.Fragment>
<VehiclesFilters />
<VehiclesList />
</React.Fragment>
);
const VehicleDetailPage = VehicleDetail;
const App = () => (
<Provider store={store}>
<BrowserRouter>
<Layout>
<Switch>
<Route component={HomePage} exact path="/" />
<Route component={VehicleDetailPage} path="/vehicles/:vehicleId" />
<Route component={VehiclesPage} path="/vehicles" />
</Switch>
</Layout>
</BrowserRouter>
</Provider>
);
ReactDOM.render(<App />, document.getElementById("root"));