我剛剛開始與React.js和我有一個關於反應路由器的問題。特別是對於在反應路由器中嵌套路由意味着什麼,我有點困惑。假設我有以下代碼(從反應路由器的GitHub的頁面獲取),當我去鏈接/inbox/messages/<id>
不收件箱組件獲得隱藏隱藏組件與反應路由器
<Router>
<Route path="/" component={App}>
{/* Show the dashboard at/*/}
<IndexRoute component={Dashboard} />
<Route path="about" component={About} />
<Route path="inbox" component={Inbox}>
<Route path="messages/:id" component={Message} />
</Route>
</Route>
</Router>
那麼會發生什麼?當你進入路由器鏈接時哪些視圖隱藏,哪些視圖保持在視線之內?還有,你如何跟蹤哪些組件被隱藏,哪些不是?
謝謝!
你的意思是說,如果我在'/ inbox/messages/1'中,我總是會看到'inbox'? – Curious
正確。 'Message'作爲一個名爲'children'的屬性傳遞給'Inbox'。你想做什麼? – aray12
我正嘗試着手使用React!我很難設置服務器和依賴項,所以我在這裏問了! – Curious