3 ms·
Keeping it simple until it is needed to expand is the best way forward, and have a little bit of resistance to the expansion. One issue that comes up is the fu
by RobKohr 6y ago
Keeping it simple until it is needed to expand is the best way forward, and have a little bit of resistance to the expansion.
One issue that comes up is the function arguments can evolve to be a mess over time with this method.
I like to always use a prop object as function arguments, even when it is simple.
function calculateArea({x, y}) rather than (x, y).
This makes it so things can be added, and be optional, and the calling function clearly can see what those values are being assigned to.
This means that the 100 times you called that function don't need to be rewritten with a new parameter added, and you don't have to have a bunch of null values set for unused cases.