Skip to content
Myr

Readme improvements

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Michel Weststrate · committed by Michel Weststrate · parent 75fa16d · Browse files · 1 file+16 added−9 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+16 added−9 removed

  • other:+16 added−9 removed

1 file+16 added−9 removed

modified:readme.md+16 added-9 removed
14 unmodified lines
15* Yarn: `yarn add immer`16* CDN: Exposed global is `immer`17 * Unpkg: `<script src="https://unpkg.com/immer/dist/immer.umd.js"></script>`18 * JSDelivr: `<script src="https://cdn.jsdelivr.net/npm/immer/dist/immer.umd.js"></script>`19 1920---2122* Egghead lesson covering all of immer (7m): [Simplify creating immutable data trees with Immer](https://egghead.io/lessons/redux-simplify-creating-immutable-data-trees-with-immer)23* Introduction blogpost: [Immer: Immutability the easy way](https://medium.com/@mweststrate/introducing-immer-immutability-the-easy-way-9d73d8f71cb3)
175 unmodified lines
199 case RECEIVE_PRODUCTS:200 action.products.forEach(product => {201 draft[product.id] = product202 })203 return204 })205 }206})207```
4 unmodified lines
212213```javascript214import produce from 'immer'215216const byId = produce(215const byId = produce((draft, action) => {216 switch (action.type) {217 case RECEIVE_PRODUCTS:218 action.products.forEach(product => {219 draft[product.id] = product220 })221 })217 (draft, action) => {218 switch (action.type) {219 case RECEIVE_PRODUCTS:220 action.products.forEach(product => {221 draft[product.id] = product222 })223 return224 }225 },226 {227 1: { id: 1, name: "product-1" }228 }223}, { 1: { id: 1, name: "product-1" } })229)230```231232## Auto freezing233
89 unmodified lines
3235. Some debuggers (at least Node 6 is known) have trouble debugging when Proxies are in play. Node 8 is known to work correctly.324325## Cool things built with immer326327* [redux-starter-kit](https://github.com/markerikson/redux-starter-kit) _A simple set of tools to make using Redux easier_328* [immer based handleActions](https://gist.github.com/kitze/fb65f527803a93fb2803ce79a792fff8) _Boilerplate free actions for Redux_329* [redux-box](https://github.com/anish000kumar/redux-box) _Modular and easy-to-grasp redux based state management, with least boilerplate_330* [quick-redux](https://github.com/jeffreyyoung/quick-redux) _tools to make redux developement quicker and easier_331
115 unmodified lines