From 1452afcb2606ffc34c9139290979e38d5e22ba3b Mon Sep 17 00:00:00 2001 From: Abir Date: Wed, 16 Sep 2020 12:49:25 +0530 Subject: [PATCH] Added the changes to master docs --- website/docs/docusaurus-core.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/website/docs/docusaurus-core.md b/website/docs/docusaurus-core.md index d5c78ea5809b..c63d8414c91f 100644 --- a/website/docs/docusaurus-core.md +++ b/website/docs/docusaurus-core.md @@ -298,6 +298,25 @@ const MyComponent = () => { }; ``` +### `onRouteUpdate({location})` + +Set the page field to current location on the default tracker, such that subsequent hits on this page are attributed to this page. +Recommended for Single-page Applications. + +Usage example: + +```jsx {2,5,6,7} +import React from 'react'; +import {onRouteUpdate} from '@docusaurus/useGlobalData'; + +const MyComponent = () => { + const location = { pathname:'./example.html' }; + + onRouteUpdate({location}); + return
Page value set to {location.pathname}
; +}; +``` + ## Modules ### `ExecutionEnvironment`