Skip to content
masterclassBuddyTech Buzz5 fresh blogs · 5:00 AM IST

Zustand · Pipe

anonymousActionType

anonymousActionType is an optional devtools setting that names mutations lacking an explicit action type in Redux DevTools. It overrides the anonymous fallback when no inferred type is available.

How it works

anonymousActionType is a devtools option that supplies the action label for mutations without an explicit action type. If no label is configured, the middleware infers one when possible and otherwise uses anonymous.

Syntax

devtools(stateCreatorFn, { anonymousActionType: string })

Parameters

NameTypeDescription
anonymousActionTypestringString used as the Redux DevTools action type for anonymous mutations; optional.

Returns

Not applicable; this is an option within devtoolsOptions.

Key points

  • It is optional; the middleware prefers an inferred action type and uses anonymous only when inference is unavailable.
  • The value is a string that becomes the Redux DevTools action type for otherwise unnamed mutations.
  • Providing the option lets you replace the default anonymous label with a project-specific action name.
  • When calling set with the replacement form, provide an action type as the third argument when you need a per-mutation label.

Common mistakes

  • Without an explicit action type or configured fallback, DevTools labels the mutation anonymous.

Example: Name anonymous DevTools mutations

import { create } from 'zustand'
import { devtools } from 'zustand/middleware'

type Store = {
  count: number
  increment: () => void
}

const useStore = create<Store>()(
  devtools(
    (set) => ({
      count: 0,
      increment: () => set((state) => ({ count: state.count + 1 })),
    }),
    { anonymousActionType: 'counter/increment' },
  ),
)

useStore.getState().increment()

Sets the Redux DevTools label used for mutations whose action type is not otherwise supplied.

When to use it

Replace generic anonymous labels with readable action names

Redux DevTools debugging

Give unnamed state mutations a consistent fallback label

Stores with direct set calls

Standardize action names across anonymous mutations

Team debugging conventions

Interview questions

QWhat does anonymousActionType control?

It is an option on devtools(stateCreatorFn, devtoolsOptions) that names anonymous mutations in Redux DevTools. The default is an inferred action type, or anonymous when inference is unavailable.

Follow-up: How would you change the fallback label? Pass anonymousActionType in the middleware options, for example { anonymousActionType: 'counter/increment' }.

QWhen is this option used?

It applies when a mutation does not provide its own action type. The configured string becomes the action type shown by Redux DevTools instead of the default anonymous fallback.

Follow-up: What happens when the option is omitted? The middleware first uses an inferred action type when available, then falls back to anonymous.

QWhere is anonymousActionType configured?

The option is passed as part of the second argument to devtools, alongside the state creator. Its value is a string used for anonymous mutations.

Follow-up: What should be checked if every action still appears as anonymous? Verify that the option is supplied to the devtools middleware and that mutations are actually anonymous rather than using a different action-labeling path.

  • devtools
  • devtoolsOptions
  • Redux DevTools

Source: devtools. Checked 2026-10-15.