DEV Community

Discussion on: Junior v. Senior React Code: Using Flags with React Components

Collapse
 
nimitwalia89 profile image
nimit walia

Having readable code doesnt mean u need to split and repeat same code. Write minimal code. Pass is self documented arguments. Imagine if you have 100s of similar kind of function much line of code would it save with good arguments.

Collapse
 
mkinoshita12 profile image
Makoto Kinoshita

I think the counterargument would be if you are repeating the same code over and over to avoid passing boolean as a flag, then you are probably abstracting at the wrong level. At the same time, I'm not saying passing a boolean to a function is always a bad idea. There are ways to make it more readable as I mentioned in the article.