# Resource Reducers

The main export of Redux Resource, [`resourceReducer`](https://github.com/jamesplease/redux-resource/tree/e0d24c6c69879d54e94c1ab9976b4b6a9d5adb7f/docs/api-reference/resource-reducer.html), is a function that returns a reducer. For each resource type in your application, you should use this function to create a reducer. A resource reducer will manage all of the state for its resource type.

Creating a resource reducer is the first step to getting started with Redux Resource. If your application manages books, then you would create a reducer for the books resource like so:

```javascript
import { resourceReducer } from 'redux-resource';

const booksReducer = resourceReducer('books');
```

Once you have your resource reducers, you need to combine them into a single reducer. Users of Redux frequently use [`combineReducers`](http://redux.js.org/docs/api/combineReducers.html) for this purpose. When you use `combineReducers`, your store is divided up into slices, where each reducer that you input manages its own section of the state. These sections are often called "slices."

The rest of this documentation will frequently refer to "resource slices," which are the slices of your store that are managed by a resource reducer.

The following code snippet demonstrates how you might set this up:

```javascript
import { combineReducers } from 'redux';
import { resourceReducer } from 'redux-resource';

const reducer = combineReducers({
  books: resourceReducer('books'),
  authors: resourceReducer('authors'),
  people: resourceReducer('people'),
});
```

The `resourceReducer` function takes a second option, which can be used to configure the resource reducer. Refer to [the API documentation for `resourceReducer`](/api-reference/resource-reducer.md) to learn more.

> Note: keep in mind that Redux Resource works with or without `combineReducers`.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://redux-resource.js.org/resources/resource-reducers.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
