Nugget 12: JavaScript Gijgo Datepicker vs React Datepicker
Around 2014, I was working as a contract full-stack developer. The client needed JavaScript a date range and wanted to see examples of what it looked like. For one of the examples, a jQuery, Bootstrap, and the Gijgo date/time picker was created. It had to be simple. This is the date range page, which is simple enough for a jQuery expert:
It worked well during the demo, and something similar was implemented. Today, I reviewed this range date picker, and after updating the Gijgo reference and refreshing the JavaScript a little, it all worked just fine.
How would I do something similar in React?
Much simpler.
For a new implementation, a React Datepicker component was used. Someone else did the hard work for me. I reused the same project created in Nugget 7 and followed the instructions by HackerOne(1). Keep in mind that there are many ways of doing this; I wanted to recreate the 2014 demo using React.
Insanely simpler solution, even better, with less code, which generates less defects, and we can now add this component anywhere it is needed. I still need to iron out the end date picker, but the idea is clear: The component is reusable; therefore, fixing issues with the component will impact everywhere it is used. This could also be achieved in ASP.Net MVC using partial views, tag helpers, or view components, not as simple as using React.
References:
- React Datepicker, by HackerOne: All you need to know to get started
Comments
Post a Comment