0.3.0 • Published 4 years ago

remos-immer v0.3.0

Weekly downloads
-
License
ISC
Repository
github
Last release
4 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

4 years ago

0.2.1

4 years ago

0.2.0

4 years ago

0.1.23

4 years ago

0.1.17

4 years ago

0.1.3

4 years ago

0.1.0

4 years ago

0.0.18

4 years ago

0.0.17

4 years ago

0.0.16

4 years ago

0.0.15

4 years ago

0.0.14

4 years ago

0.0.13

4 years ago

0.0.12

4 years ago

0.0.11

4 years ago

0.0.10

4 years ago

0.0.9

4 years ago

0.0.8

4 years ago

0.0.7

4 years ago

0.0.6

4 years ago