Time travel with Immer

2021-06-14

The easiest way to time travel to the past is using Immer.

With Immer you can create a new object from any other object, without touch that original object. For example:

import { product } from 'immer';

const user = { name: 'Example', age: 30 };

const newUser = produce(user, draft => {
  draft.name = 'New Name'
});

This you probably already know.

#en#immer#state