handleSubmit(e) { e.preventDefault() const node = this.refs.input const text = node.value.trim() if (text) { this.props.onAddSubmit(text) node.value = '' } }
handleClick(e) { const node = ReactDOM.findDOMNode(this.refs.input); const text = node.value.trim(); this.props.onAddClick(text); node.value = ''; }
handleClick(e) { const node = this.refs.input const text = node.value.trim() this.props.onAddClick(text) node.value = '' }
update() { this.setState( { a: this.a.value, b: this.refs.b.value, c: ReactDOM.findDOMNode(this.c).value, d: this.d.refs.input.value } ) }
handleClick() { const node = ReactDOM.findDOMNode(this.refs.input); const what_select = ReactDOM.findDOMNode(this.refs.select_tab); const which_tab = what_select.value.trim(); const text = node.value.trim(); const checked = false; console.log(this); this.props.onAddClick(text, which_tab, checked); node.value = ''; }
setInputValue(val) { // Generally mutating DOM is a bad idea in React components, // but doing this for a single uncontrolled field is less fuss // than making it controlled and maintaining a state for it. this.refs.input.value = val }
componentDidMount () { this.refs.input.addEventListener('blur', this.onBlur); this.focus(); }
handleSubmit(e) { e.preventDefault() const node = this.refs.input const inputText = node.value.trim() if (inputText) { this.mapInputToHandler(inputText) node.value = '' } }
handleClick(e) { const node = findDOMNode(this.refs.input); const text = node.value.trim(); this.props.onAddClick(text); node.value = ''; }
handleClick(e) { const inputNode = findDOMNode(this.refs.input); const text = inputNode.value.trim(); this.props.onAddClick(text); inputNode.value = ''; }
handleClick(e) { const node = findDOMNode(this.refs.input); const text = node.value.trim(); this.props.onAddClick(text); node.value = ''; }