亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

react-router4 Route中的children屬性作用是什么

react-router4 Route中的children屬性作用是什么

胡子哥哥 2019-03-07 17:15:26
看了官方文檔,沒想明白是干什么的,和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.


查看完整回答
反對 回復 2019-03-28
  • 2 回答
  • 0 關注
  • 584 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號