0.3.0 • Published 2 years ago

remos-immer v0.3.0

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

remos-immer

An Immer wrapper for Remos

Installation

NPM

npm i remos-immer --save

YARN

yarn add remos-immer

Usages

With remos-immer

import { create, inject } from "remos";
import { withImmer } from "remos-immer";

inject(withImmer());

const todoModel = create({
  todos: [],
  add(todo) {
    this.todos.push(todo);
  },
  remove(id) {
    const index = this.todos.findIndex((x) => x.id === id);
    this.todos.splice(index, 1);
  },
});

Without remos-immer

import { create, configure } from "remos";

const todoModel = create({
  todos: [],
  add(todo) {
    this.todos = [...this.todos, todo];
  },
  remove(id) {
    const index = this.todos.findIndex((x) => x.id === id);
    this.todos = [
      ...this.todos.slice(0, index),
      ...this.todos.slice(index + 1),
    ];
  },
});
0.3.0

2 years ago

0.2.1

2 years ago

0.2.0

2 years ago

0.1.23

2 years ago

0.1.17

2 years ago

0.1.3

2 years ago

0.1.0

2 years ago

0.0.18

2 years ago

0.0.17

2 years ago

0.0.16

2 years ago

0.0.15

2 years ago

0.0.14

2 years ago

0.0.13

2 years ago

0.0.12

2 years ago

0.0.11

2 years ago

0.0.10

2 years ago

0.0.9

2 years ago

0.0.8

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago