MikeRogers0 / Ruby-Meetup-Calendar

List all the current Ruby Meetups
https://ruby-meetup-calendar.mikerogers.io
MIT License
23 stars 9 forks source link

refactor JS #59

Closed optimistic-updt closed 3 years ago

optimistic-updt commented 3 years ago

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 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. Screen Shot 2021-05-06 at 9 14 34 pm

3) refactored CalendarDay => renderEvents function to a ternary Screen Shot 2021-05-07 at 9 07 05 am

4) Changed the var to a const in classnames function Screen Shot 2021-05-06 at 9 17 43 pm

How to test: Run the site and it should all still be working

MikeRogers0 commented 3 years ago

This is awesome! Thank you @CumulusGround !