# Browsers & React Native

Easy Peasy ships ESM and CommonJS bundles. The library targets the same environments that React 19 supports — modern evergreen browsers and current React Native runtimes.

# Why Immer?

Easy Peasy uses Immer (opens new window) to power the mutation-based API supported within actions:

addTodo: action((state, payload) => {
  // Mutating the state directly! 🤯
  //           👇
  state.items.push(payload);
});

Immer converts these mutation operations into immutable updates against the store. This is a much improved developer experience over managing immutable updates yourself, particularly for deeply nested state. The same action without Immer would look like:

addTodo: action((state, payload) => {
  return {
    ...state,
    items: [...state.items, payload],
  };
});

# Proxy is required

Immer relies on the Proxy (opens new window) global. Every browser in React 19's supported list (opens new window) ships native Proxy, as do all current React Native runtimes (Hermes, JSC), so no polyfill is required.

Migrating from v6? Easy Peasy v6 shipped an easy-peasy/proxy-polyfill subpath that opted Immer into an ES5 fallback for environments without native Proxy (notably IE11). v7 upgrades to Immer v11, which removed ES5 mode entirely, so the subpath has been deleted. Remove any import 'easy-peasy/proxy-polyfill'; lines — see the v6 → v7 upgrade guide for details.

# Supporting Map or Set within your state

To use Map or Set within your state you need to opt into Immer's Map/Set support (opens new window) by importing the following module as early as possible in your application's entry file:

import 'easy-peasy/map-set-support';