mobx-create-stores
Version:
creates an object with MobX stores (+ links stores to routes)
17 lines (14 loc) • 626 B
JavaScript
import { matchPath } from 'react-router';
export default (function (_ref) {
var _ref$stores = _ref.stores,
stores = _ref$stores === undefined ? [] : _ref$stores,
location = _ref.location,
path = _ref.path,
_ref$exact = _ref.exact,
exact = _ref$exact === undefined ? false : _ref$exact,
_ref$strict = _ref.strict,
strict = _ref$strict === undefined ? false : _ref$strict,
onMatch = _ref.onMatch;
var match = matchPath(location.pathname, { path: path, exact: exact, strict: strict });
if (match && onMatch) onMatch({ stores: stores, match: match, history: history });
});