|
|
|
|
|
by disillusionist
426 days ago
|
|
I started using this pattern years ago and haven't looked back. React components are defined using a single properties param and it feels natural to extend the practice to other methods and helper functions that I write. One nice unexpected side effect is that I end up with more consistency in variable naming when using a param object in order to benefit from object definition shortcuts. ie I will usually write something like const firstName = getFirstName(); doTheThing({ firstName });
rather than const fName = getFirstName(); doTheThing({ firstName: fName });
|
|
string combineName(string first, string last);
Okay, I assume the result is the full name, but I don't really know that like I would if the return had a name in the header. (The function can be getFullName, yes, but that's so simple it doesn't matter).