Closed frankcollins3 closed 1 year ago
attempting to do: modularize /dashboard.tsx -> and break different UI into different components to refactor.
error: Dashboard.tsx:70 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'find')
for this code: const getDay:any = hydroData.find( (day) => moment(day.date, 'YYYY-M-D').format('MM-DD-YYYY') === formatHighlightDay ); if (getDay) { console.log('getDay') console.log(getDay) // setSelectedDay(getDay); dispatch(SET_SELECTED_DAY(getDay)) dispatch(TOGGLE_PROGRESS_SHOW()) } }
for this interface: export interface HydroDataInterface { id:number, google_id:string, date:string, progress:number, weekday:string, status:string[], users_id:number }
proposed approach: 0: change redux state
1: generics with typescript.
// tbh about to deploy this app and redo: ghub.com/frankcollins3/mine-nugget-ts and add: graphql, @redux/toolkit, redis proper UI structure:
probably going to change redux state to be any and use generics for next time.
changing redux is working. postponing learning generics but will during next app.
attempting to do: modularize /dashboard.tsx -> and break different UI into different components to refactor.
error: Dashboard.tsx:70 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'find')
for this code: const getDay:any = hydroData.find(
(day) => moment(day.date, 'YYYY-M-D').format('MM-DD-YYYY') === formatHighlightDay ); if (getDay) {
console.log('getDay') console.log(getDay) // setSelectedDay(getDay); dispatch(SET_SELECTED_DAY(getDay)) dispatch(TOGGLE_PROGRESS_SHOW()) } }
for this interface: export interface HydroDataInterface { id:number, google_id:string, date:string, progress:number, weekday:string, status:string[], users_id:number }
proposed approach: 0: change redux state
1: generics with typescript.
// tbh about to deploy this app and redo: ghub.com/frankcollins3/mine-nugget-ts and add: graphql, @redux/toolkit, redis proper UI structure:
probably going to change redux state to be any and use generics for next time.