0
이것은 부모에게 데이터를 전달해야하는 자손 구성 요소입니다.잡히지 않은 TypeError : 응답에서 null의 of 'property'속성을 읽을 수 없습니다.
class Sidebar extends React.Component {
getUserInput(event){
event.preventDefault();
let value = document.getElementById('input-button').value;
console.log(value);
this.props.handleSubmit(value);
}
render() {
return (
<div>
<input type="text" id="input-button" placeholder="YGUID" />
<button type="button" className="btn btn-info btn-icons" onClick={this.getUserInput} />
</div>
);
}
}
Sidebar.propTypes = {
handleSubmit: React.PropTypes.func
};
여기가 부모가 handleSubmit을 호출하는 곳입니다.
......
handleSubmit(data){
console.log(data);
}
render(){
return(
<div className="col-md-2 left-pane">
<Sidebar handleSubmit= {this.handleSubmit}/>
</div>
);
}
다음과 같은 오류가 발생합니다.
Uncaught TypeError: Cannot read property 'props' of null
여기서 잘못된 것은 무엇입니까?
'getUserInput' 함수의'console.log (this)'는 무엇을 돌려 주나요? 제발이 [이 게시물] (http://stackoverflow.com/questions/35303490/uncaught-typeerror-cannot-read-property-props-of-null). – nicovank