Skip to content

Commit 5421674

Browse files
committed
path 가 변경될 때에만 컴포넌트를 새로고침하도록 수정
동일화면으로 hitory.push 가 될 경우 무한루프 라우팅 오류 수정
1 parent b9f5649 commit 5421674

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export function AsyncComponent(props) {
2727
setComponent(null)
2828
cleanedUp = true
2929
}
30-
}, [props])
30+
}, [props.path])
3131

3232
return Component
3333
? React.createElement(Component, props.otherProps)
@@ -52,6 +52,7 @@ export default function DynamicRoute(props) {
5252

5353
return (
5454
<AsyncComponent
55+
path={window.location.pathname}
5556
component={props.page(window.location.pathname)}
5657
loading={props.loading || 'Loading..'}
5758
onError={props.onError || onError}

0 commit comments

Comments
 (0)