Hooks

Plugins that provide the functionality to Lore

Introduction

Lore applications do a lot of things, including mounting the application, setting up routing, generating reducers and actions, and orchestrating data fetching for components. But at it's core, Lore doesn't have any of that functionality built into it.

Lore itself isn't a framework so much as a plugin engine, and it's all the plugins that combine to make it a framework for building React applications. At it's core, Lore only does two things:

  1. Define the rules for how config files are loaded and combined
  2. Define the interface for what these plugins should look like, and how to specify dependencies between them, in order to determine the order they should be loaded

These plugins are referred to as hooks, and new projects include a set of default hooks, which you can see if you open up the index.js file at the root of your project:

// Hooks
import auth from 'lore-hook-auth';
import actions from 'lore-hook-actions';
import bindActions from 'lore-hook-bind-actions';
import collections from 'lore-hook-collections';
import connections from 'lore-hook-connections';
import connect from 'lore-hook-connect';
import models from 'lore-hook-models';
import react from 'lore-hook-react';
import reducers from 'lore-hook-reducers';
import redux from 'lore-hook-redux';
import router from 'lore-hook-router';

// Summon the app!
lore.summon({
  hooks: {
    auth,
    actions,
    bindActions,
    collections,
    connections,
    connect,
    models,
    react,
    reducers,
    redux: _.extend(redux, {
      dependencies: ['reducers', 'auth']
    }),
    router
  }
});