Data-fetching tier for Lore


This functionality is provided by lore-hook-actions.

Actions are the data-fetching tier for Redux (or least that's what Lore uses them for). Any API communication that occurs will be done by an action, including creating, updating, deleting, and fetching data.

Before reading this documentation, it's recommended that you already understand what actions are, as this section will document the actions that are built into Lore, but it will not explain what actions are in general.

To learn more them at a foundational level, see the Actions and Action Creators documentation on the Redux website.

Action Blueprints

Lore automatically creates the set of default actions for every model you've defined, using the built in blueprints for create, destroy, get, find, and update.

If you have defined custom actions within the src/actions directory, it will also merge those actions into the defaults, overwriting any default actions that have the same name.

Example Usage

Let's say you create a tweet model, similar to the Quickstart:


This hook will automatically create 5 actions associated with that model that cover common CRUD operations. The signatures for those actions look like this:


Example usage for each action is provided below:


This action is used to create a new tweet. The signature looks like create(params) and is invoked like this:

  text: 'Some message to tweet'


This action is used to delete a new tweet. The signature looks like destroy(model) and is invoked like this:

const { tweet } = this.props;



This action is used to fetch a specific tweet, and can optionally include query parameters to be sent in the request. The signature looks like get(id, query) and is invoked like this:

const tweetId = 1;

The second query argument is helpful when you need to provide additional query parameters to the API server such as when asking it to nest resources:

const tweetId = 1;

lore.actions.tweet.get(tweetId, {
  _embed: 'user'


This action is used to fetch a set of tweets. The signature looks like find(query, pagination) and is invoked like this:

var userId = this.props.params.userId;

  user: userId
  page: 1,
  pageSize: 20


This action is used to update a tweet. The signature looks like update(model, params) and is invoked like this:

var tweet = this.props.tweet;

lore.actions.tweet.update(tweet, {
  text: 'Modified tweet message'