I refactored your JavaScript folder to look a bit more like what you see in the wild, maybe...
I didn’t touch the part where it hooks back into your apps because I’m not sure how it does that so I didn’t want to break anything
1) Refactor stateless class component to functions
Because you are not using states (and these days, even if you did), I refactor your classes to function. They are a bit cleaner and come with a bit more safeguard.
i.e. you don’t have to bind the this, etc….
You then don’t need the render method and the this.props is replace by destructuring the prop object in the function arguments
2) In the calendarEvents component, it seems that the _formatted_datetime() function is unused so I deleted it.
3) refactored CalendarDay => renderEvents function to a ternary
4) Changed the var to a const in classnames function
How to test:
Run the site and it should all still be working
Hi Mike,
Hope you are well.
I refactored your JavaScript folder to look a bit more like what you see in the wild, maybe...
I didn’t touch the part where it hooks back into your apps because I’m not sure how it does that so I didn’t want to break anything
1) Refactor stateless class component to functions Because you are not using states (and these days, even if you did), I refactor your classes to function. They are a bit cleaner and come with a bit more safeguard. i.e. you don’t have to bind the
this
, etc…. You then don’t need therender
method and thethis.props
is replace by destructuring the prop object in the function arguments2) In the
calendarEvents
component, it seems that the_formatted_datetime()
function is unused so I deleted it.3) refactored
CalendarDay
=>renderEvents
function to a ternary4) Changed the var to a const in classnames function
How to test: Run the site and it should all still be working