我有以下结构:
<CategoryRecipesList>
<Title> Recipes for {this.props.category} </Title>
<Mesh> You can also click on : {categoryList.map(el => <Link to={'categories/' + el}>{el}</Link>} </Mesh>
<Grid>
recipes.map((s, i) => <Card {...s}/>)
</Grid>
</CategoryRecipesList>
我在 CategoryList 组件上有一个构造函数,用于获取 recipes
根据 category
列出参数。
当我点击<Link/>
时标签、标题和 url 更新,但 <Card>
不更新s 在网格中。
有人知道吗?
最佳答案
您可能正在查看Update Blocking 。尝试用 withRouter 包装 Card 组件.
export default withRouter(Card)
关于javascript - 我的 react 路由器链接标签不会更改我的页面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43497939/