【发布时间】:2019-09-13 12:12:04
【问题描述】:
如何从父组件重新渲染/刷新子组件。
家长:
export default class Home extends React.Component {
constructor(props) {
super(props)
render() {
//I have a tab bar, when i tap on a tab the below line gets executed
this.childComponent = <ChildComponent onCategorySeeMorePress={this.categorySeeMoreClicked} />;
}
}
孩子
export default class ChildComponent extends Component {
render() {
<FlatList
style={styles.flatlist}
data={this.state.cardsMainModel.cards}
renderItem={this._renderItem.bind(this)}
horizontal={false}
keyExtractor={this._keyExtractorInfoSection}
/>
}
现在在特定条件下从父级,我想刷新子组件。 有人可以告诉我如何从父组件刷新/重新渲染子组件。
【问题讨论】:
标签: react-native react-native-ios react-native-flatlist