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

Redux Toolkit · Function

isDraft

isDraft checks whether a value is a Proxy-wrapped Immer draft state. Redux Toolkit re-exports this Immer utility for inspecting values handled during immutable update logic.

Since
1.5.1

How it works

isDraft is a re-export of Immer's function. It tests whether a value is a Proxy-wrapped draft state, which is useful when code may receive either ordinary data or state currently being produced by Immer.

Syntax

isDraft(value)

Returns

A boolean indicating whether the supplied value is a Proxy-wrapped Immer draft.

Key points

  • Redux Toolkit exposes isDraft as a re-export of the function from Immer.
  • It tests whether the provided value is an Immer draft wrapped in a Proxy.
  • The documentation identifies RTK 1.5.1 as the point when the related Immer helpers became RTK exports.

Common mistakes

  • It detects draft status; it does not convert, finalize, or update the value.

Example: Check for a draft value

import { isDraft } from '@reduxjs/toolkit';

const draft = { value: 1 };
console.log(isDraft(draft)); // false

Checks whether a value is an Immer draft.

When to use it

Distinguish drafts from plain values

A helper receives values from both reducer logic and ordinary application code.

Inspect reducer state

Reducer-related debugging needs to identify whether a value is still wrapped by Immer.

Choose draft-aware handling

Code branches based on whether a value is managed by Immer.

Interview questions

QWhat does isDraft determine?

isDraft checks whether a value is an Immer draft represented by a Proxy wrapper. Redux Toolkit re-exports it from Immer, so it can be imported from @reduxjs/toolkit.

Follow-up: How can you inspect a draft without exposing the Proxy? Use Immer's current utility, which creates a snapshot of the current draft state.

QWhen might isDraft be useful?

It is useful in code that may handle both ordinary values and values currently wrapped by Immer during reducer execution. The result is a boolean indicating whether the supplied value is a draft.

Follow-up: What related utility retrieves the original value without draft updates? Immer's original utility.

QHow is isDraft related to Redux Toolkit?

Redux Toolkit re-exports isDraft along with related Immer utilities. The documentation states that these exports were added to RTK as of version 1.5.1.

Follow-up: Which Redux Toolkit APIs use Immer automatically? createReducer and createSlice use Immer internally.

  • current
  • original
  • createReducer
  • createSlice

Source: Other Exports. Checked 2026-10-15.