mutative • Docs
mutative / original
original<
T
>(target
):T
original(draft)
to get original state in the draft mutation function.
import { create, original } from '../index';
const baseState = { foo: { bar: 'str' }, arr: [] };
const state = create(
baseState,
(draft) => {
draft.foo.bar = 'str2';
expect(original(draft.foo)).toEqual({ bar: 'str' });
}
);
• T
• target: T
T