💾 Archived View for tdem.in › post › overengineering-rant.gmi captured on 2022-06-03 at 22:54:08. Gemini links have been rewritten to link to archived content

View Raw

More Information

-=-=-=-=-=-=-

Back to blog

Rant: Overengineering

2019-07-16 22:48

Consider a typical web dev situation: React, Redux, Material-UI, a new JSS-decorated component that's going to be connected with Redux. We create a new file, write the component code in it, then export it like that:

export default withStyles(styles)(connect(mapStateToProps)(MyComponent));

This simple line contains at least 5 functions in it. Let's tear this down right-to-left:

functional component

function that returns the mapping

decorator function

And we're only done with the first part of this abomination! Now let's proceed to the outer block:

has to be a function

Yep, that's how easy it is to overengineer in React/modern JS. The code above might not exactly be a good example of a well-designed component, but this gives you an idea of how things generally go.