It would make it possible to do something like this
const result = produce({}, (draft) => {draft.foo.bar.baz = 2})
where result would be
{
foo: {
bar: {
baz: 2
}
}
It would allow creating desired objects from empty objects without boilerplate.
There are packages that already support this (nevernull from the top of
my head).
It should not be part of Immer imho for several reasons:
On Tue, Mar 19, 2019 at 5:54 PM Adam Pietrasiak notifications@github.com
wrote:
๐ Feature Proposal
It would make it possible to do something like this
const result = produce({}, (draft) => {draft.foo.bar.baz = 2})
where result would be
{
foo: {
bar: { baz: 2 }}
Motivation
It would allow creating desired objects from empty objects without
boilerplate.โ
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/mweststrate/immer/issues/337, or mute the thread
https://github.com/notifications/unsubscribe-auth/ABvGhNl2atSvbxdDzHdpODju9GXx1iPzks5vYRZPgaJpZM4b8ox6
.
Most helpful comment
There are packages that already support this (
nevernullfrom the top ofmy head).
It should not be part of Immer imho for several reasons:
javascript constructs to create immutable objects
solved by another package. making it available by default in produce would
be a matter of simple composition from there.
On Tue, Mar 19, 2019 at 5:54 PM Adam Pietrasiak notifications@github.com
wrote: