forked from imshubhamsingh/file-system-react
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
49 lines (40 loc) · 1.17 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
41
42
43
44
45
46
47
48
49
import React, { Fragment } from 'react';
import { BrowserRouter as Router } from 'react-router-dom';
import { render } from 'react-dom';
import { Provider } from 'react-redux';
import { createStore } from 'redux';
import { composeWithDevTools } from 'redux-devtools-extension';
import { BrowserRouter } from 'react-router-dom';
import Sidebar from '@Components/Sidebar';
import '@Styles/App.scss';
import reducers from '@Reducer';
import { ViewFiles } from '@Pages';
import generatedummyFileSystem from '@Utils/dummyFileSystem';
const rootEl = document.getElementById('root');
const store = createStore(
reducers,
{
fileSystem:
localStorage.getItem('fileSystem') &&
Object.keys(localStorage.getItem('fileSystem')).length > 0
? JSON.parse(localStorage.getItem('fileSystem'))
: generatedummyFileSystem()
},
composeWithDevTools()
);
const App = () => (
<Provider store={store}>
<Router>
<BrowserRouter>
<Fragment>
<Sidebar />
<ViewFiles />
</Fragment>
</BrowserRouter>
</Router>
</Provider>
);
const renderComponent = Component => {
render(<Component />, rootEl);
};
renderComponent(App);