/*! For license information please see fee3f507.83999df7.js.LICENSE.txt */
"use strict";(self.webpackChunkweb_totals=self.webpackChunkweb_totals||[]).push([[2371],{83840:(t,e,o)=>{o.r(e),o.d(e,{assets:()=>i,contentTitle:()=>l,default:()=>p,frontMatter:()=>a,metadata:()=>s,toc:()=>c});var r=o(85893),n=o(11151);const a={title:"Scroll Restoration in Nextjs",authors:"hunghg",tags:["Nextjs","Scroll Restoration"],image:"https://decodenatura.com/static/fb8aa1bb70c9925ce1ae22dc2711b343/nextjs-logo.png"},l=void 0,s={permalink:"/blog/scroll-restoration-nextjs",editUrl:"https://github.com/hunghg255/web-totals/tree/main/blog/scroll-restoration-nextjs.md",source:"@site/blog/scroll-restoration-nextjs.md",title:"Scroll Restoration in Nextjs",description:"Experimental scroll restoration flag",date:"2023-04-07T11:04:02.000Z",formattedDate:"April 7, 2023",tags:[{label:"Nextjs",permalink:"/blog/tags/nextjs"},{label:"Scroll Restoration",permalink:"/blog/tags/scroll-restoration"}],readingTime:1.345,hasTruncateMarker:!0,authors:[{name:"Gia Hung",title:"Creator of Web totals",url:"https://github.com/hunghg255",email:"giahung197bg@gmail.com",imageURL:"https://res.cloudinary.com/hunghg255/image/upload/v1654956015/Screen_Shot_2022-06-07_at_11.25.34_bpnymt.png",key:"hunghg"}],frontMatter:{title:"Scroll Restoration in Nextjs",authors:"hunghg",tags:["Nextjs","Scroll Restoration"],image:"https://decodenatura.com/static/fb8aa1bb70c9925ce1ae22dc2711b343/nextjs-logo.png"},unlisted:!1,prevItem:{title:"HTML Input Type",permalink:"/blog/html-input"},nextItem:{title:"X\u1eed l\xfd form v\u1edbi Ant Design (Ph\u1ea7n 1)",permalink:"/blog/handle-form-antd-part-1"}},i={authorsImageUrls:[void 0]},c=[{value:"Experimental scroll restoration flag",id:"experimental-scroll-restoration-flag",level:2}];function u(t){const e={a:"a",h2:"h2",p:"p",...(0,n.a)(),...t.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(e.h2,{id:"experimental-scroll-restoration-flag",children:"Experimental scroll restoration flag"}),"\n",(0,r.jsxs)(e.p,{children:["Luckily, Next.js has an ",(0,r.jsx)(e.a,{href:"https://github.com/vercel/next.js/commit/38bd1a024cb25923d8ea15f269a7294d073684d8",children:"experimental scrollRestoration flag"})," that you can enable to automatically restore the scroll positions."]})]})}function p(t={}){const{wrapper:e}={...(0,n.a)(),...t.components};return e?(0,r.jsx)(e,{...t,children:(0,r.jsx)(u,{...t})}):u(t)}},75251:(t,e,o)=>{var r=o(67294),n=Symbol.for("react.element"),a=Symbol.for("react.fragment"),l=Object.prototype.hasOwnProperty,s=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};function c(t,e,o){var r,a={},c=null,u=null;for(r in void 0!==o&&(c=""+o),void 0!==e.key&&(c=""+e.key),void 0!==e.ref&&(u=e.ref),e)l.call(e,r)&&!i.hasOwnProperty(r)&&(a[r]=e[r]);if(t&&t.defaultProps)for(r in e=t.defaultProps)void 0===a[r]&&(a[r]=e[r]);return{$$typeof:n,type:t,key:c,ref:u,props:a,_owner:s.current}}e.Fragment=a,e.jsx=c,e.jsxs=c},85893:(t,e,o)=>{t.exports=o(75251)},11151:(t,e,o)=>{o.d(e,{Z:()=>s,a:()=>l});var r=o(67294);const n={},a=r.createContext(n);function l(t){const e=r.useContext(a);return r.useMemo((function(){return"function"==typeof t?t(e):{...e,...t}}),[e,t])}function s(t){let e;return e=t.disableParentContext?"function"==typeof t.components?t.components(n):t.components||n:l(t.components),r.createElement(a.Provider,{value:e},t.children)}}}]);