ラジオ ボタンを表示する React コンポーネントがあります。これらへの変更はRefluxによって処理されるべきです。私が理解しているようthis.trigger(object)
に、オブジェクトへの変更を保存するために呼び出す必要があります。残念ながら、それは無限ループを引き起こします。
エラーを示すJSFiddle hereを投稿しました。誰かが私が間違っていることを見ることができますか? どのonUpdateAutoComplete(checked)
ように作成する必要がありますか?
<AutoCompleteFrom autocomplete_from={form_fields.autocomplete_from} />
チェックボックスコンポーネント
var AutoCompleteFrom = React.createClass({
mixins: [Reflux.connect(store)],
render: function() {
var autocompleteFrom = this.props.autocomplete_from.map(function(value) {
return (
<label for={value}>
<input type="radio" name={'autocomplete_from'+this.props.id} value={value}
onChange={actions.updateAutoComplete(this.props.checked)}
checked={this.props.checked == value}
/>
{value}
</label>
);
}, this);
return (
<div className="autocomplete-from">
{autocompleteFrom}
</div>
);
}
});
onUpdateAutoComplete
onUpdateAutoComplete(checked){
console.log('checked:', checked);
rows[0].autocomplete_from = checked;
// this.trigger(rows); // <== Causes an infinite loop when included.
},
乾杯、マーティン