0
我想滾動到自定義組件的位置,但引用它沒有返回一個有效的html節點。方法「goToContactUs」應該執行該操作。這將是最好的方式來做到這一點?滾動到自定義組件
class Help extends Component {
constructor() {
super();
this.goToContactUs = this.goToContactUs.bind(this);
}
goToContactUs() {
this.contactUs.scrollIntoView();
}
render() {
return (
<div>
<ToggleContainer
title={this.props.strings['Contact Us']}
show={this.props.help.showContactUs}
toggle={this.contactUsHandler}
ref={(div) => { this.contactUs = div }}
>
<ContactUs sendEmail={this.props.sendEmail} emailSuccess={this.props.help.emailSuccess} />
</ToggleContainer>
</div>
);
}
}