Hello, I have a custom array control renderer in React, but the props.addItem function only adds an item to the end of the array. How to insert an item to the specified index?
Instead of using addItem
you can use the “raw” handleChange
instead and hand over the complete new array on the array path.
Thank you for your response!
But I have an additional question: why is there no handleChange
in the ArrayControlProps
interface? I was a bit confused when I saw the type.
In React we provide handleChange
to both the array control and array layout renderers, see here and here. However it’s not reflected in the type. This should be fixed, feel free to open an issue against the main repository for this.
As a workaround you can recast the type on your side until then.