我用我的陣營0.13應用這樣的方法subrender(分裂的助手方法反應組件的創建)。但是,我得到了一個錯誤:參考文獻如何作用於反應0.14
Invariant Violation: addComponentAsRefTo(...): Only a ReactOwner can have refs. You might be adding a ref to a component that was not created inside a component's
render
method
那麼,怎樣才能管理上創建反應依賴於DOM組件飛我避免發胖我的主要呈現方式?
任何線索如何重構是在0.14的新辦法作出反應的版本?
module.exports = React.createClass({
displayName: 'Typed',
render: function() {
var _this = this;
return (
React.createElement("div", {
style: {
position: 'relative'
},
className: 'react-typeahead-container ' + _this.props.className},
_this._renderInput(),
_this._renderDropdown(),
_this._renderAriaMessageForOptions(),
_this._renderAriaMessageForIncomingOptions()
)
);
},
_renderInput: function() {
var _this = this,
state = _this.state,
props = _this.props,
inputValue = props.inputValue,
inputValue = props.inputValue,
className = 'react-typeahead-input',
inputDirection = getTextDirection(inputValue);
return (
React.createElement("div", {
style: {
position: 'relative'
},
className: "react-typeahead-input-container"},
React.createElement(Input, {
ref: "input", //this does not works :(
role: "combobox"
)
)
);
},
順便說一句,您是否需要_React_模塊? –
當然兄弟,陣營模塊它之前必需的,但感謝你 – OsDev
我沒有面對它。但是這裏(http://stackoverflow.com/questions/28519287/what-does-only-a-reactowner-can-have -refs-mean)是類似的問題。我希望它能幫助你 –