Request for MapWritableState nested object access.
See original GitHub issueWhat problem is this solving
Modifying deeply nested properties in the state.
Proposed solution
// Object
...mapWritableState(useStore, {
myCity: 'form.address.city',
})
// Array ( outputs the latest key as the variable name, in this case city)
...mapWritableState(useStore, ['form.address.city'])
Issue Analytics
- State:
- Created 2 years ago
- Reactions:6
- Comments:8 (3 by maintainers)
Top Results From Across the Web
How can I access and process nested objects, arrays, or JSON?
Accessing nested data structures. A nested data structure is an array or object which refers to other arrays or objects, i.e. its values...
Read more >pinia - Bountysource
The object in the first param in a getter used to be a state. Now (in 0.1.0) it seems to be the ......
Read more >Accessing Nested Objects in JavaScript - DEV Community
Access Nested Objects Using Array Reduce. Array reduce method is very powerful and it can be used to safely access nested objects. const ......
Read more >Accessing Nested Objects in JavaScript - HackerNoon
Oliver Steele's Nested Object Access Pattern. This is my personal favorite as it makes the code look clean and simple. I picked this...
Read more >Nested field type | Elasticsearch Guide [8.5] | Elastic
Internally, nested objects index each object in the array as a separate hidden document, ... they can only be accessed within the scope...
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 FreeTop 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
Top GitHub Comments
We have lots of code where we pass the full path to the state and use only the last ‘key’ as the local name. Would love to see this working in Pinia, because it is the only thing holding us back of migrating from Vuex -> Pinia.
Is there any update to this? We’d also love to be able to do this or just pass a function like with mapState(). 😃