Replies: 1 comment 2 replies
-
Hi, this is interesting. I mean I learn the real use case. So, the answer is Would you try |
Beta Was this translation helpful? Give feedback.
-
Hi, this is interesting. I mean I learn the real use case. So, the answer is Would you try |
Beta Was this translation helpful? Give feedback.
-
Hi,
I'm trying to use
proxyWithComputed
but I am not sure how to modify arrays nested in objects. Here is an example that works without usingproxyWithComputed
. https://codesandbox.io/s/peaceful-poincare-5n600?file=/src/App.tsx.The
state
consists ofselectedPageIndex
and an array ofpage
objects. Eachpage
object consists of an array ofrow
objects, and eachrow
object consists of atitle
string andselected
boolean. If the user clicks on a row object, it should swap theselected
attribute. The example above works just by getting theselectedPage
within theApp
component:I would like to have
selectedPage
be part of thestate
object, like so:However, how do I modify objects nested in
state.selectedPage
here? I am not sure how to change the set function to accomplish this. Here is the code sandbox forproxyWithComputed
https://codesandbox.io/s/weathered-morning-4qlre?file=/src/App.tsx:729-915. I am not able to add rows or change the selected attribute on click.Thanks in advance for your help!
Beta Was this translation helpful? Give feedback.
All reactions