Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 | 31 |
Tags
- 도메인
- swift
- angular
- https
- php
- Android
- 안드로이드
- angular4
- beanstalk
- 카카오톡
- 감사일기
- 알려줌
- Elastic Beanstalk
- S3
- AWS
- Route53
- node.js
- node
- JavaScript
- ios
- 페이스북
- 네이티브
- TypeScript
- NeXT
- cors
- fanzeel
- hybrid
- nextjs
- 웹뷰
- react
Archives
- Today
- Total
목록2018/07/05 (1)
쪼렙 as! 풀스택
Next.js - Router.push() 로, 라우팅 이동 후, 맨 위로 스크롤
Next.js 의 Router 을 이용해서 라우팅을 변경할 경우,스크롤이 맨 처음으로 이동하지 않고 유지하고 있다. 그래서 보통은 componentDidMount() 에서 window.scrollTo(0,0) 을 하는 방법들이 많이 보이는데,이럴 경우, 백버튼을 눌렀을 때도 무조건 맨 위로 올라가게 되어있다. 백버튼을 눌러서 다시 이동했을 때는, 스크롤유지가 되기를 원한다면,Router.push().then() 안에서, scrollTo() 를 해준다. const asHref = "/page/"+pageUri+"/report/"+reportId Router.push({pathname: '/ReportDetail', query: {uri:pageUri, reportId:reportId}}, asHref) ...
개발 일지/Web & Server
2018. 7. 5. 15:52