[question] deep state, destructuring & action verbosity/DRY
See original GitHub issuehey guys,
i donāt believe there is something like concise notation for deep destructuring:
const x = ({a.b.c}) => c.foo;
most examples with hyperapp use a flat state, so they look simple. but the app size will grow rather quickly and become less DRY as you have to repeat the state structure in multiple places. adding just one level to the counter example results in a lot more repetitive action code, or any code that can return partial state (but must be aware of the entire ancestor state structure): https://codepen.io/anon/pen/ZJrrGW?editors=0010
attempts to make it smaller [understandably] donāt quite work: https://codepen.io/anon/pen/MvQQje?editors=0010
thoughts? thanks!
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:49 (30 by maintainers)
Top Results From Across the Web
Using ES6 To Destructure Deeply Nested Objects in ... - ITNEXT
Today, I will show you how to use ES6 to destructure nested objects, my friends, AND what's more, prevent the dreaded undefined error...
Read more >Destructuring assignment - JavaScript - MDN Web Docs
The destructuring assignment syntax is a JavaScript expression that makes it possible to unpack values from arrays, or properties fromĀ ...
Read more >ES6 deep nested object destructuring - Stack Overflow
I would like to extract statement object and the isConfirmed property in the same line. const { statement: { isConfirmed }, statement }...
Read more >Destructuring assignment - The Modern JavaScript Tutorial
Destructuring assignment is a special syntax that allows us to āunpackā arrays or objects into a bunch of variables, as sometimes that'sĀ ...
Read more >Removing Object Properties with Destructuring
Object destructuring allows us to create variables from object property names, ... for writing JavaScript and managing state (state being our data )....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
āAll problems in computer science can be solved by another level of abstractionā¦except for the problem of too many levels of abstraction.ā [1]
š
[1] https://en.wikipedia.org/wiki/Indirection
Okay, I think I have an idea⦠š”
or
Definitely an improvement of the weird
state(path, fn)
syntax a few posts above and a possibility now that the state is POJO.Also, this ~might be~ is possible to implement outside core as a mixin using thunks and resolve.