Skip to content

Commit

Permalink
docs(readme): update doc
Browse files Browse the repository at this point in the history
  • Loading branch information
unadlib committed Dec 20, 2022
1 parent 404485a commit 96677ae
Showing 1 changed file with 38 additions and 1 deletion.
39 changes: 38 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,54 @@ Efficient creation of immutable state
10x faster than immer

## Motivation

TBD
### Performance

TBD

### Features

- apply patches
- Supports optional freezing
- Custom shallow copy
- immutable and mutable markable
- Strict mode for safer mutable data access

### Difference between Immer and Mutative

| - | Mutative | Immer |
| :---------------------------- | -------: | :-------------: |
| Best performance |||
| Default common data structure || ❌(auto freeze) |
| Non-invasive marking |||
| Automatic type inference |||
| Complete freeze data |||

## Installation

```sh
yarn install mutative # npm install mutative
```

## Examples

```ts
const baseState = {
foo: 'bar',
list: [{ text: 'coding' }],
};

const state = create(baseState, (draft) => {
draft.foo = 'foobar';
draft.list.push({ text: 'learning' });
});
```

## Migration from Immer to Mutative

TBD

## APIs

- `create()`
Expand Down Expand Up @@ -101,4 +138,4 @@ const state = create(baseState, (draft) => {

## FAQs


TBD

0 comments on commit 96677ae

Please sign in to comment.