Closed ShaneChesnutt closed 7 years ago
Can add a note saying "you'll need to bind the click handler to the class so that the this
context (and, therefore, the component state) is accessible.
@ShaneChesnutt you're going to kill me, but I just realized one more thing we need to document with this section... how do you pass in the target data member with the click handler? For example, let's say you have the following data structure:
[{
first: 'john',
last: 'doe',
email: 'john@doe.com'
}, {
first: 'Mary',
last: 'doe',
email: 'mary@doe.com'
}]
and you ng-repeat
it with an <button ng-click='vm.edit(row)'>edit</button>
for each row, how does vm.edit
function know which array item to set row.editMode = true
for. We know this is rather easy in angular by looking for the index of the item in the larger array, but how would this work in React?
Okay I'll make sure to add that in
On Sun, Dec 11, 2016, 10:04 PM Matthew Vita notifications@github.com wrote:
@ShaneChesnutt https://github.com/ShaneChesnutt you're going to kill me, but I just realized one more thing we need to document with this section... how do you pass in the target data member with the click handler? For example, let's say you have the following data structure:
[{ first: 'john', last: 'doe', email: 'john@doe.com' }, { first: 'Mary', last: 'doe', email: 'mary@doe.com' }]
and you ng-repeat it with an <button ng-click='vm.edit(row)>editfor edit row, how doesvm.editfunction know which array item to setrow.editMode = true` for. We know this is rather easy in angular by looking for the index of the item in the larger array, but how would this work in React?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/GoTeamEpsilon/angular-to-react/pull/42#issuecomment-266333404, or mute the thread https://github.com/notifications/unsubscribe-auth/AE9XHq974m1oO3awaPuLHjgeDMkKb0Mwks5rHLmngaJpZM4LKIeA .
@ShaneChesnutt actually you need to add the following to your example: