Closed yayongi closed 4 years ago
Nested Router 를 적용 시 문제가 있음. 형제 레벨의 컴포넌트에서 state 변경으로 인해 Nested Router를 호출할 시, 초기화되는 문제가 있음.
App.js <Route path="/expense/annualList" component={AnnualList} />>
<Route path="/expense/annualList" component={AnnualList} />>
ApprovalList의 index.js // 중첩 Router 구현 `export default function ApprovalList ({match}) { return (
<> {/* 경비결재관리 목록 화면 */} <Route exact path={match.path} render={(props) => <MainLayout> <List routeProps={props} /> </MainLayout> } /> {/* 경비결재관리 상세화면 */} <Route path={`${match.path}/view/:id`} render={(props) => <MainLayout> <View routeProps={props} /> </MainLayout> } /> </>
); };`
component로 전달하는 과정없이, 진행하면 해결됨 <Route exact path='/expense/annualList' render={(props) => <MainLayout> <AnnualList routeProps={props} /> </MainLayout> } />
Nested Router 를 적용 시 문제가 있음. 형제 레벨의 컴포넌트에서 state 변경으로 인해 Nested Router를 호출할 시, 초기화되는 문제가 있음.
App.js
<Route path="/expense/annualList" component={AnnualList} />>
ApprovalList의 index.js // 중첩 Router 구현 `export default function ApprovalList ({match}) { return (
); };`