render() {
<ListView
ref={'listView'}
dataSource={this.state.dataSource}
renderRow={this.renderRow}
renderSectionHeader={this.renderSectionHeader}
/>
},
renderSectionHeader() {
<DXTextMenu
ref={'textMenu'}
style={{height: TEXT_MENU_HEIGHT}}
/>
},
componentDidMount() {
// Got it
const list = this.refs['listView'];
// Not found
const textMenu = this.refs['textMenu'];
},
As the code shows, I can get the listView ref but not the listView's header's ref, how can I get it?
Use callback refs, which are superior to string refs: ref={component => whatever}
Most helpful comment
Use callback refs, which are superior to string refs:
ref={component => whatever}