看了官方文档,没想明白是干什么的,和Route的render属性有什么区别?const OldSchoolMenuLink = ({ label, to, activeOnlyWhenExact }) => ( <Route path={to} exact={activeOnlyWhenExact} children={({match}) => ( <div className={match ? 'active' : ''}> {match ? '>' : ''}<Link to={to}>{label}</Link> </div> )}></Route>);
2 回答
MMMHUHU
TA贡献1834条经验 获得超8个赞
找到官方解释了
Sometimes you need to render whether the path matches the location or not. In these cases, you can use the function children prop. It works exactly like render except that it gets called whether there is a match or not.
添加回答
举报
0/150
提交
取消