This is not entirely true.
Behavior similar to its confusion. He must have a very specific responsibility for, for example: a hint, a warning or the like.
Of course, you can do this with an extended view that has the same functionality, but if you need to implement several different logics, for example, you need pop-ups, alert functions and labels, you have to build a chain with the extension.
As you know, it is harder to read, maintain, and you may lose performance. Behavior allows you to implement several logics at once:
var MyView = Marionette.ItemView.extend({ ui: { "close": ".close-btn" }, behaviors: { CloseWarn: { message: "you are closing all your data is now gone!" }, ToolTip: { text: "what a nice mouse you have" } } });
This code is much more understandable and readable.
Thus, the use of behavior expects them as a mix of a very specific function. Do it as little as possible. Do not let them "know a lot."
source share