Skip to content

Commit

Permalink
Add example for gatsby-browser.js API shouldUpdateScroll
Browse files Browse the repository at this point in the history
  • Loading branch information
amslezak committed Feb 4, 2018
1 parent a83b7b8 commit 7b5d72d
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/gatsby/src/utils/api-browser-docs.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ exports.onRouteUpdate = true
* @param {object} $0
* @param {object} $0.prevRouterProps The previous state of the router before the route change.
* @param {object} $0.pathname The new pathname
* @example
* exports.shouldUpdateScroll = (prevRouterProps, pathname) => {
* window.scrollTo(0, 0) // upon navigation, scroll to top of page
* return false
* };
*/
exports.shouldUpdateScroll = true

Expand Down

0 comments on commit 7b5d72d

Please sign in to comment.