> For the complete documentation index, see [llms.txt](https://redux-resource.js.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://redux-resource.js.org/api-reference/set-resource-meta.md).

# setResourceMeta

Update one or more individual resources with the same metadata.

## Arguments

1. `options` *(Object)*: An object that defines how to update the metadata. The options are as follows:
   * `resources` *(Array|Object)*: An array of the resources, or resource IDs, to update with the new meta.
   * `newMeta` *(Object)*: The meta to set on each of the resources.
   * `meta` *(Object)*: The current resource meta object from this resource's store slice. Optional when `mergeMeta` is `false`, required otherwise.
   * \[`initialResourceMeta`] *(Object)*: Additional metadata to add to any resource that previously did not have meta.
   * \[`mergeMeta`] *(Boolean)*: Whether or not to merge a resource's old metadata with the new metadata. Defaults to `true`.

## Returns

(`Object`): The new resource meta object.

## Example

```javascript
import { setResourceMeta } from 'redux-resource';
import actionTypes from './my-action-types';

export default function reducer(state, action) {
  switch (action.type) {
    case (actionTypes.SELECT_MANY_RESOURCES): {
      const meta = setResourceMeta({
        resources: action.resources,
        meta: state.meta,
        newMeta: {
          selected: true
        }
      });

      return {
        ...state,
        meta
      };
    }
  }
}
```

## Tips

* This is used internally within the reducer returned by

  [`resourceReducer`](/api-reference/resource-reducer.md) to update the resource meta in your

  state tree. You will typically only need to use this method if you're writing

  a [plugin](/other-guides/custom-action-types.md).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://redux-resource.js.org/api-reference/set-resource-meta.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
