The data-fetching decorator for Lore


This blueprint allows you to extract a model from the store by it's cid attribute.


It's not clear how useful this blueprint is in practice, but occasionally you do need to find data by the cid value, such as when you're waiting or looking for confirmation of when data is confirmed to be created by the server.

If it makes sense to use a connect call to accomplish that, now you can.

import { connect } from 'lore-hook-connect';
import moment from 'moment';

connect((getState, props) => {
  return {
    tweets: getState('tweet.all', {
      where: function(tweet) {
        return ! || moment( > 0
      sortBy: function(tweet) {
        return -moment(;

The above getState call will look through the tweet.byCid reducer and return the tweet with the cid of c2.

If no tweet exists with the matching cid, the call will return undefined.


export default {

  defaults: {
    cid: null

  verifyParams: function(params) {
    if (!params.cid) {
      throw new InvalidGetStateCall(this.reducerKey);

  getAction: function(actions) {
    // no op

  getPayload: function(reducerState, params) {
    const key = params.cid;
    return reducerState[key];