update support 4.0.0

This commit is contained in:
Isman Usoh
2016-02-24 09:16:56 +07:00
parent 0560e36eb1
commit 48f543f2e4
2 changed files with 13 additions and 18 deletions
+5 -10
View File
@@ -6,15 +6,10 @@
import { createStore, combineReducers, applyMiddleware } from 'redux';
import { browserHistory } from 'react-router';
import { syncHistory, routeReducer } from 'react-router-redux';
import { syncHistoryWithStore, routerReducer } from 'react-router-redux';
const reducer = combineReducers({ routing: routeReducer });
const reducer = combineReducers({ routing: routerReducer });
const store = createStore(reducer);
// Sync dispatched route actions to the history
const reduxRouterMiddleware = syncHistory(browserHistory);
const createStoreWithMiddleware = applyMiddleware(reduxRouterMiddleware)(createStore);
const store = createStoreWithMiddleware(reducer);
// Required for replaying actions from devtools to
reduxRouterMiddleware.listenForReplays(store);
// Create an enhanced history that syncs navigation events with the store
const history = syncHistoryWithStore(browserHistory, store)
+8 -8
View File
@@ -1,4 +1,4 @@
// Type definitions for react-router-redux v2.1.0
// Type definitions for react-router-redux v4.0.0
// Project: https://github.com/rackt/react-router-redux
// Definitions by: Isman Usoh <http://github.com/isman-usoh>, Noah Shipley <https://github.com/noah79>, Dimitri Rosenberg <https://github.com/rosendi>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
@@ -10,15 +10,15 @@ declare namespace ReactRouterRedux {
import R = Redux;
import H = HistoryModule;
const TRANSITION: string;
const UPDATE_LOCATION: string;
const CALL_HISTORY_METHOD: string;
const LOCATION_CHANGE: string;
const push: PushAction;
const replace: ReplaceAction;
const go: GoAction;
const goBack: GoForwardAction;
const goForward: GoBackAction;
const routeActions: RouteActions;
const routerActions: RouteActions;
type LocationDescriptor = H.Location | H.Path;
type PushAction = (nextLocation: LocationDescriptor) => void;
@@ -34,13 +34,13 @@ declare namespace ReactRouterRedux {
goForward: GoForwardAction;
goBack: GoBackAction;
}
interface HistoryMiddleware extends R.Middleware {
listenForReplays(store: R.Store, selectLocationState?: Function): void;
interface HistoryMiddleware extends H.History {
unsubscribe(): void;
}
function routeReducer(state?: any, options?: any): R.Reducer;
function syncHistory(history: H.History): HistoryMiddleware;
function routerReducer(state?: any, options?: any): R.Reducer;
function syncHistoryWithStore(history: H.History, store: R.Store, options?: any): HistoryMiddleware;
function routerMiddleware(history: H.History): Function;
}
declare module "react-router-redux" {