1
jQueryの "changeDate"イベント(jqueryUI date)コールバック関数から反応するコンポーネントの状態にアクセスする方法。jQueryコールバック関数でreactjsコンポーネントの状態にアクセスする方法
var subheader = React.createClass({
getInitialState: function() {
return {
msg: this.props.msg
};
},
componentDidMount: function() {
$('#date').datepicker({
format: "dd/mm/yyyy"
}).on("changeDate", function (e) {
console.log(this.state.msg);
});
},
render: function() {
return (
// render HTML here.
)
}
});
しかし、this.stateを取得することは定義されていません。誰にでも助けてくれますか?
正しい\にアクセスする[方法の可能性のある重複 'この\ '/コールバック内のコンテキスト?](http://stackoverflow.com/questions/20279484/how-to-access-the-correct-this-context-inside-a-callback) –