Closed frankcollins3 closed 1 year ago
attempting to do: handle the input:
error: hitting backspace once chops off all characters besides the last. also, the last character cannot be deleted because of this.
https://github.com/frankcollins3/fill_container/assets/73137934/842ca63f-01e9-4739-b05d-080a9eedca0e
let key:string = event.key let value:string = event.target.value const valueLength:number = inputVal.length if (key !== 'Meta' || 'tab') { key === "Backspace" ? setInputVal(`${inputVal.slice(valueLength - 1, valueLength)}`) : setInputVal(`${inputVal}${key}`) } else { } }
proposed approach: 0: switch keyDown() that should probably be onChange prop() to its expected purpose.
1: would be nice to adjust the slice to achieve desired output
} else { key === "Backspace" ? setInputVal(${inputVal.slice(0, -1)}) : setInputVal(${inputVal}${key}) }
${inputVal.slice(0, -1)}
${inputVal}${key}
[11:20am]
attempting to do: handle the input:
error: hitting backspace once chops off all characters besides the last. also, the last character cannot be deleted because of this.
https://github.com/frankcollins3/fill_container/assets/73137934/842ca63f-01e9-4739-b05d-080a9eedca0e
proposed approach: 0: switch keyDown() that should probably be onChange prop() to its expected purpose.
1: would be nice to adjust the slice to achieve desired output