# Comparison

> How this Fabric.js undo redo library compares with fabric-history, fabricjs-react and hand-written toJSON saving, so you can pick the right fit.

Source: https://fabricjs-document-engine.jscrate.dev/docs/overview/comparison
Last updated: 2026-09-28

People usually look for a Fabric.js undo redo library first, then find out they also need saving, ids and conflict checks. Below, the common options side by side. Versions were checked on npm in September 2026.

## At a glance

|                              | Hand-written `toJSON`  | `fabric-history` 2.0       | `fabricjs-react` 2.2 | This package             |
| ---------------------------- | ---------------------- | -------------------------- | -------------------- | ------------------------ |
| Fabric.js versions           | any                    | 5                          | 5 and 6              | 6 and 7                  |
| Undo and redo                | write it yourself      | yes                        | no                   | yes                      |
| How undo is stored           | —                      | whole canvas JSON per step | —                    | only the changed objects |
| Stable object ids            | no                     | no                         | no                   | yes                      |
| Save and load with storage   | write it yourself      | no                         | no                   | yes                      |
| Autosave and conflict checks | no                     | no                         | no                   | yes                      |
| Custom properties kept       | list them on each call | list them on the canvas    | —                    | register once            |
| Crash recovery               | no                     | no                         | no                   | yes                      |
| React hooks                  | —                      | —                          | yes                  | yes, optional            |

## Hand-written `toJSON` and `loadFromJSON`

Fabric.js can already turn the canvas into JSON and back. For a demo, that is all you need. The work starts when the editor goes to real users: stable ids, images that fail to load, loads that race each other, saves that arrive out of order, and undo. The [why a document engine](https://fabricjs-document-engine.jscrate.dev/docs/overview/why-document-engine) page lists each of these problems.

## `fabric-history`

`fabric-history` is a small Fabric.js undo redo library. You import it once and it adds `canvas.undo()` and `canvas.redo()` to every canvas by patching `Canvas.prototype`. Each step stores the whole canvas as a JSON string, which is simple but gets slow and heavy with large drawings. Version 2.0 depends on Fabric.js 5, and it does not save, load or assign ids.

Choose it if you only need undo on a small Fabric.js 5 canvas.

## `fabricjs-react`

`fabricjs-react` gives React a canvas component and a hook to reach the Fabric.js editor. It helps you mount the canvas in React. It does not save documents or record history, so you can use it together with this package.

## This package

This package is the choice when people save work in your editor. Undo stores only what changed, so a step stays fast with thousands of objects. Saving is one-at-a-time with revision checks, and unsaved work survives a crash. It needs Fabric.js 6 or 7.

If you only want undo and never save anything, a smaller Fabric.js undo redo library may be enough. If you save, compare the [production checklist](https://fabricjs-document-engine.jscrate.dev/docs/production/production-checklist) with what you would have to build yourself.

## Next steps

- [Undo and redo](https://fabricjs-document-engine.jscrate.dev/docs/guides/undo-redo): how history works here.
- [Migration](https://fabricjs-document-engine.jscrate.dev/docs/guides/migration): moving from Fabric.js 5 JSON.
