Skip to content

Instantly share code, notes, and snippets.

@pahund
Last active October 14, 2018 20:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pahund/c7f3b811399dbeb8f1355623e19a4352 to your computer and use it in GitHub Desktop.
Save pahund/c7f3b811399dbeb8f1355623e19a4352 to your computer and use it in GitHub Desktop.
Registering selectors for use with global state
import { registerSelectorsForUseWithGlobalState } from '@modular-toolkit/selectors';
import { selectors as hackerNews } from '@modular-toolkit/demo-module';
import { selectors as home } from './pages/home';
import { selectors as about } from './pages/about';
import { selectors as contact } from './pages/contact';
const selectorMapping = {
'bricks.hackerNews': hackerNews,
'pages.home': home,
'pages.about': about,
'pages.contact': contact
};
export default () => {
for (const [path, selectors] of Object.entries(selectorMapping)) {
registerSelectorsForUseWithGlobalState(path, selectors);
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment