UNPKG

mobx-create-stores

Version:

creates an object with MobX stores (+ links stores to routes)

21 lines (12 loc) 285 B
import {matchPath} from 'react-router'; export default ({ stores = [], location, path, exact = false, strict = false, onMatch }) => { const match = matchPath(location.pathname, {path, exact, strict}); if (match && onMatch) onMatch({stores, match, history}); };