You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am researching some example code about React based on director.js.
The example code shows that I have to bind thisArg to make sure the app could work well.
Could you please tell me why I have to bind this in router function?
Here is the snippet of the code.
componentDidMount: function () {
var setState = this.setState;
var router = Router({
'/': setState.bind(this, {nowShowing: app.ALL_TODOS}),
'/active': setState.bind(this, {nowShowing: app.ACTIVE_TODOS}),
'/completed': setState.bind(this, {nowShowing: app.COMPLETED_TODOS})
});
router.init('/');
},
The text was updated successfully, but these errors were encountered:
I am researching some example code about React based on director.js.
The example code shows that I have to bind thisArg to make sure the app could work well.
Could you please tell me why I have to bind this in router function?
Here is the snippet of the code.
The text was updated successfully, but these errors were encountered: