createSelector(orm, …args) → {function}

Returns a memoized selector based on passed arguments. This is similar to reselect's createSelector, except you can also pass a single function to be memoized.

If you pass multiple functions, the format will be the same as in reselect. The last argument is the selector function and the previous are input selectors.

When you use this method to create a selector, the returned selector expects the whole redux-orm state branch as input. In the selector function that you pass as the last argument, you will receive a session argument (a Session instance) followed by any input arguments, like in reselect.

This is an example selector:

// orm is an instance of ORM
const bookSelector = createSelector(orm, session => {
    return => {
        return Object.assign({}, book.ref, {
            authors: =>,
            genres: =>,

redux-orm uses a special memoization function to avoid recomputations.

Everytime a selector runs, this function records which instances of your Models were accessed.
On subsequent runs, the selector first checks if the previously accessed instances or args have changed in any way:

  • If yes, the selector calls the function you passed to it.
  • If not, it just returns the previous result (unless you call it for the first time).

This way you can use the PureRenderMixin in your React components for performance gains.

Name Type Attributes Description
orm ORM

the ORM instance

args function <repeatable>

zero or more input selectors and the selector function.


memoized selector


getByIdQuery() → {Object}

Generates a query specification to get the instance's corresponding table row using its primary key.