frankcollins3 / Next-Water-App

Happy, Healthy Water Cycling App that tracks user/human fluid intake.
https://next-water-app.vercel.app
1 stars 0 forks source link

modularity working against the approach [3:29pm] #43

Closed frankcollins3 closed 11 months ago

frankcollins3 commented 11 months ago

attempting to do: port utility func over but adapt to @redux/toolkit from redux. dispatch can't be used as a hook

error: problem is redux syntax. The utility function takes (REDUX_STATE, SET_REDUX_STATE) as params. 👍 standard react-redux: SET_STATE works.

👎 @redux/toolkit: dispatch(SET_STATE()) how to arrange the dispatch to get this working. there are 2 invocations: 1: SET_STATE() is invoked with the value gets auto-parsed as {payload} 2: dispatch() encapsulates that above SET_STATE() invocation, additionally.

Screen Shot 2023-07-14 at 3 27 51 PM

Screen Shot 2023-07-14 at 3 28 18 PM

proposed approach: 1: already giving this app a refactor. There is saved space in terms of lines of code. probably doesn't hurt to bring inputHandler() outside of modularity and into functional component scope.

2: if it can work send dispatch over with the function

3: thought of this last minute but can also use .tsx: either useContext or a func-component. sounds overkill but good to know that viability is there (pretty sure)

frankcollins3 commented 11 months ago

forgot this function wasn't even used. 👎 "*".repeat(STATE.length) ...

👎 using this method of not hashing but hiding the actual characters used was done before I realized: 👍 <input type="password" accomplishes the same thing.

I solved that problem then by having: DUMMY_PASSWORD redux state that had the "*".repeat(DUMMY_PASSWORD.length) asserted which would *** the input PASSWORD_INPUT would be the real state that would never be set as the value prop for input.

[3:59pm]