Recently, I faced a dilemma when naming my react functions. I saw my colleagues named some functions as
To me previously, this was not acceptable because, I was thinking that when the user performed a certain action, then we trigger the function. So I would name it as
However, when I surveyed around with other senior engineers and did some googling, I realised that my idea of "correct" function names
has been wrong all these while. There should not be any
past tense in your function names!
Naming your functions in
present tense. For eg:
To me code quality is very important which translate to naming your functions clearly. Moving forward, I shall stick to naming them with present tense for action related functions.