A bit of overhead

At an earlier stage of FIRSTMastery, I ran into a common issue where I was writing a lot of unnecessary duplicated code for actionable elements such as a button for activate, approve, delete etc... For each button or specific element I would write code that would have a listener and gets triggered when clicked/hovered etc... The code was getting very cumbersome and I didn't very much like the direction I was heading into.I made an attempt to resolving it by introducing the concept of dataActionables. The idea was to describe all the general request types that I'd normally need to write a separate JavaScript function for, and instead generalize it so I only have to specify the different actions from the elements. In this way I would have an element, describe the action type that element implements on click/hover and pass the parameters in an expected data field all specific to that action using the html5 data attributes. This enabled me to keep the front end a bit DRYer than before.

The dataActionables enabled me to easily do more, but then earlier this week I ran into another issue with them. I realized that in the current direction I was heading I will inevitably write various types of dataActionables and then a second thought came across my head,

"Isn't there a library that resolves this already or should I make this into a separate library so that I can easily integrate it into other projects I face the same issues with?".

@Noslki mentioned that I should take a look at FLux and React. I plan on playing with these this week to see how I can better incorporate them into the project.

I am worried that they will introduce a lot of overhead to the project, but if it all goes well, I'll be going it. Worst case scenario, I will implement dataActionables into a separate library to make work easier. One of the primary influential factors is whether this will regress or deter others from wanting to contribute. The winner would most likely be the approach that would offer the best benefits to the project's future.

ps: If you by any chance know a library that resolves this you can mail me at: me[at]wilfriede[dot]me

*hfoss weekly update