Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Solution] solution for Link's problem #24

Open
munjinoo opened this issue May 30, 2018 · 1 comment
Open

[Solution] solution for Link's problem #24

munjinoo opened this issue May 30, 2018 · 1 comment
Labels
Solution Solution for some problems

Comments

@munjinoo
Copy link
Owner

Link로 이동할때 같은 컴포넌트면 props가 달라져도 새로 마운트를 안하는 문제가 있음
그렇다고 componentDidUpdate()쓰기엔 child때문에 지속적으로 업데이트 되는듯 하다.
이 문제를 해결하려면 App.js에서 <Router/>createElement라는 props를 추가하면 된다
stackoverflow
ReactTraining issue

@munjinoo munjinoo added the Solution Solution for some problems label May 30, 2018
@munjinoo
Copy link
Owner Author

굳이 모든 page에서 저렇게 새로 마운트 시켜 비용을 늘리는 방법대신 필요한 page에서만 새로 마운트 해주는 방법도 있다
<Route path='somewhere' component={props => <SomeComponent key={some_key} {...props} />} />

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Solution Solution for some problems
Projects
None yet
Development

No branches or pull requests

1 participant