const clickCondition = key === 'Backspace' || key === 'Tab' || key === 'Meta' || key === 'Control' || key === 'Shift'
if (clickCondition) {
console.log('Meta or friends')
return
} else { key === "Backspace" ? setInputVal(${inputVal.slice(0, -1)}) : setInputVal(${inputVal}${key}) }
start defining conditions in this way, but doing so now makes a store seem a good idea.
error:
started setting up context with this same condition. and see 2 ideas:
👎 to have event.key as a parameter sent through context which doesn't make sense.
👎 let key = " " define key but don't provide a value to it, then use the condition in the func with event.key (won't work)
proposed approach:
encountered this question of whether it's possible to do this by:
1: Using interfaces made this look like it would be possible to just export conditions
2: defining regex as a variable. To see an expression without being string, array, object was a surprise.
attempting to do:
const clickCondition = key === 'Backspace' || key === 'Tab' || key === 'Meta' || key === 'Control' || key === 'Shift' if (clickCondition) { console.log('Meta or friends') return } else { key === "Backspace" ? setInputVal(
${inputVal.slice(0, -1)}
) : setInputVal(${inputVal}${key}
) } start defining conditions in this way, but doing so now makes a store seem a good idea.error: started setting up context with this same condition. and see 2 ideas: 👎 to have event.key as a parameter sent through context which doesn't make sense. 👎 let key = " " define key but don't provide a value to it, then use the condition in the func with event.key (won't work)
proposed approach:
encountered this question of whether it's possible to do this by: 1: Using interfaces made this look like it would be possible to just export conditions 2: defining regex as a variable. To see an expression without being string, array, object was a surprise.