In a backdraftjs component with watchable 'titleString', is there any difference/preference between
this.watch('titleString', this.handleTitleStringChange);
and
onMutateTitleString(newTitle, oldTitle) {
...
}
The onMutate
has the benefit that it remembers the old value (oldTitle
) but this.watch()
is maybe a little easier to find in code since it contains the word titleString
-- where for onMutate you have to know to search for the camelcased-and-concatenated version.
Are there any other reasons to use one or the other?
Via Active questions tagged javascript - Stack Overflow https://ift.tt/9yCVw1N
Comments
Post a Comment