mirror of
https://github.com/microsoft/frontend-bootcamp.git
synced 2026-01-26 14:56:42 +08:00
moving step2-7 to bonus content
This commit is contained in:
29
bonus-servicecalls/demo/src/index.tsx
Normal file
29
bonus-servicecalls/demo/src/index.tsx
Normal file
@@ -0,0 +1,29 @@
|
||||
import React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
import { reducer } from './reducers';
|
||||
import { createStore, applyMiddleware } from 'redux';
|
||||
import { TodoApp } from './components/TodoApp';
|
||||
import { Provider } from 'react-redux';
|
||||
import { initializeIcons } from '@uifabric/icons';
|
||||
import { composeWithDevTools } from 'redux-devtools-extension';
|
||||
import thunk from 'redux-thunk';
|
||||
import * as service from './service';
|
||||
import { Store, FilterTypes } from './store';
|
||||
|
||||
(async () => {
|
||||
const preloadStore = {
|
||||
todos: (await service.getAll()) as Store['todos'],
|
||||
filter: 'all' as FilterTypes
|
||||
};
|
||||
|
||||
const store = createStore(reducer, preloadStore, composeWithDevTools(applyMiddleware(thunk)));
|
||||
|
||||
initializeIcons();
|
||||
|
||||
ReactDOM.render(
|
||||
<Provider store={store}>
|
||||
<TodoApp />
|
||||
</Provider>,
|
||||
document.getElementById('app')
|
||||
);
|
||||
})();
|
||||
Reference in New Issue
Block a user