Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to perform mutations inside a store #453

Open
Rednas83 opened this issue Jun 8, 2024 · 2 comments
Open

How to perform mutations inside a store #453

Rednas83 opened this issue Jun 8, 2024 · 2 comments

Comments

@Rednas83
Copy link

Rednas83 commented Jun 8, 2024

Something like

store.patch({
  count: store.count + 1,
  age: 120,
  name: 'DIO',
})

OR

store.patch((state) => {
  state.items.push({ name: 'shoes', quantity: 1 })
  state.hasChanged = true
})
@Rednas83
Copy link
Author

Rednas83 commented Jun 8, 2024

Sorry, just found it in the docs. Even possible with setItem I see. That's cool🚀
image

Not sure yet how to push to an array yet.

Something like this

store.patch((state) => {
  state.items.push({ name: 'shoes', quantity: 1 })
  state.hasChanged = true
})

Is that also possible?

@Rednas83 Rednas83 closed this as completed Jun 8, 2024
@Rednas83 Rednas83 reopened this Jun 8, 2024
@Rednas83
Copy link
Author

Rednas83 commented Jul 7, 2024

Any thoughts?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant