I'm trying to figure out what's the proper way of ...
# compose
z
I'm trying to figure out what's the proper way of naming a lambda callback for an event 1️⃣
onClickBack
2️⃣
onBackClick
2️⃣ 2
👀 1
f
This is subjective. For my composables, if there's just one click callback, I name it
onClick
. If there are multiple, something like
onRefreshClick
,
onShowNextClick
and so on.
f
onActionClick Where action is your desired action name
d
It depends on personal preference, like if you are team members then i suggest name it according to it's action, i.e.
onGoBackClick
,
onMemberClick
,
onDeleteClick
I create according to above so if other team member want to change code they can understand it. But if you are going to code it only for your own use, Naming does not matter as you are going to understand it directly.
f
But if you are going to code it only for your own use, Naming does not matter as you are going to understand it directly.
I would disagree with that. When you come back to your project 6 months later if you have been naming stuff all over the place, you won't be having a good time
d
@Francesc You are right about that. For me it wont be 6 months, it may be less then 6 month too.🤣