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

ConditionContext? store for conditions [11:38am] #247

Open frankcollins3 opened 1 year ago

frankcollins3 commented 1 year ago

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.