Skip to content

Commit

Permalink
Added onRouteUpdate in versioned_docs πŸ‘¨β€πŸ’»
Browse files Browse the repository at this point in the history
Added to version-2.0.0-alpha.63
  • Loading branch information
imabp authored Sep 12, 2020
1 parent 9bf4dfb commit 24c94cb
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions website/versioned_docs/version-2.0.0-alpha.63/docusaurus-core.md
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,27 @@ 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 <div>Page value set to {location.pathname}</div>;
};
```

## Modules

### `ExecutionEnvironment`
Expand Down

0 comments on commit 24c94cb

Please sign in to comment.