frankcollins3 / fill_container

codecamp team project updated with new icon screen menu + puppeteer icon search, GraphQL, redux, relational psql !mongo, and accuweatherAPI
1 stars 0 forks source link

keydown ? || onChange ? 11:00am] #246

Closed frankcollins3 closed 1 year ago

frankcollins3 commented 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

frankcollins3 commented 1 year ago

} else { key === "Backspace" ? setInputVal(${inputVal.slice(0, -1)}) : setInputVal(${inputVal}${key}) }

[11:20am]