0.3.0 • Published 3 years ago

remos-immer v0.3.0

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

3 years ago

0.2.1

3 years ago

0.2.0

3 years ago

0.1.23

3 years ago

0.1.17

3 years ago

0.1.3

3 years ago

0.1.0

3 years ago

0.0.18

3 years ago

0.0.17

3 years ago

0.0.16

3 years ago

0.0.15

3 years ago

0.0.14

3 years ago

0.0.13

3 years ago

0.0.12

3 years ago

0.0.11

3 years ago

0.0.10

3 years ago

0.0.9

3 years ago

0.0.8

3 years ago

0.0.7

3 years ago

0.0.6

3 years ago