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
Cannot mutate a Store directly #4
Comments
Correct, you need to use the built in methods. I'm very sorry that I don't appear to have mentioned this in the docs, but You can see the methods on FormArray here: https://github.com/jorroll/solid-forms#iformarray |
Thanks for the quick response. can you give me a way to modify array element positions, if possible? |
Hey @kapilpipaliya, I expect this will work for you: // first we clone the control's `controls` value
const controls = [ ...attrs.controls ] // or attrs.controls.slice()
// then we mutate the cloned `controls` value
controls.splice(toIndex, 0, ...controls.splice(fromIndex, 1));
// then we use the `setControls()` method to update the control's `controls` value
attrs.setControls(controls);
// etc... |
I don't think it matters for your example, but, as mentioned in the Getting Started section, |
I updated the readme in multiple places to note that |
Cannot mutate a Store directly
The text was updated successfully, but these errors were encountered: