const inputValue = items[index].inputValue;
const updatedItems = items.toSpliced(index, 1, {
...items[index],
inputValue: inputValue.slice(0, selectionStart)
}, {
checkboxValue: false,
inputValue: inputValue.slice(selectionStart)
});
JavaScript's .splice() or the immutable version, .toSpliced() has always been weird, but is a great fit for modifying one element while adding another. Maybe not the most self-documenting (1 is how many to delete). A little wrapper function could make it better.
I'm always on the lookout for the latest "utilities" library, in the lines of the original, underscore, lodash, Ramda. Now their's es-toolkit, radash, and typedash.
I looked for a simple "remove" element function in es-toolkit but didn't see one. The fewer the libraries, the better anyway.