Module: router

Source:

Methods


<inner> createHistory( [history] [, memoryHistoryOptions])

pass the internal react-router pieces necessary to build a custom history

Parameters:
Name Type Argument Default Description
history function | 'browser' | 'hash' | 'memory' <optional>
browser

type of history to create

memoryHistoryOptions Object <optional>

options specific to creating a memory history

Source:
Returns:
Type
Object
Example
import createHashHistory from 'history/lib/createHashHistory';
import {
 createHistory
} from 'arco';

// create using the string shorthand
// valid values are "browser", "hash", "memory"
const history = createHistory('browser');

// or with a custom function
const history = createHistory((useRouterHistory) => {
 return useRouterHistory(createHashHistory)({
   queryKey: false
 });
});

<inner> syncHistoryWithImmutableStore(history, store [, options])

convenience function to sync your history to your store when it is using redux-immutable

Parameters:
Name Type Argument Default Description
history Object

history that the application uses

store Object

redux store for the application state

options Object <optional>
{}

additional options for syncHistoryWithStore

Source:
Returns:
Type
Object
Example
import {
 createHistory,
 createStore,
 syncHistoryWithImmutableStore
} from 'arco';

import modules from 'modules';

const history = createHistory();
const store = createStore(modules, {
 isImmutable: true
});

const syncedHistory = syncHistoryWithImmutableStore(history, store);