I have the following code which passes values of an array of objects down to a component.
{
recipes.value.map((recipe) => (
<RecipeBrowserItem
key={"browse-item-" + recipe.nodeId}
isMember={recipe.isMember}
slug={recipe.slug}
members={recipe.teamRecipe.nodes[0].recipeMembers.totalCount}
teamRecipeId={recipe.teamRecipe.nodes[0].id}
teamMemberId={identity.teamMemberId}
onClickJoin={handleClickJoinRecipe}
/>
));
}
On the actual component the onClickJoin takes both teamRecipeId and teamMemberId so I am passing them down just to use a callback, can at least teamRecipeId be binded so that I don't have to pass it down?
I am basically just doing
const handleJoinRecipe = useCallback(() => {
onClickJoin(teamRecipeId, teamMemberId);
}, [teamRecipeId, teamMemberId]);