Skip to content

Commit

Permalink
Update docusaurus-core.md
Browse files Browse the repository at this point in the history
  • Loading branch information
yangshun authored Mar 29, 2020
1 parent 5138078 commit 63ee326
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions website/docs/docusaurus-core.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,16 +115,18 @@ function Home() {

### `<BrowserOnly/>`

This component excludes `children` passed via render function during the prerendering stage of the build process. This is useful for hiding code that is only meant to run in the browsers (e.g. where the `window`/`document` objects are being accessed).
The `<BrowserOnly>` component accepts a `children` prop, a render function which will not be executed during the pre-rendering phase of the build process. This is useful for hiding code that is only meant to run in the browsers (e.g. where the `window`/`document` objects are being accessed).

```jsx
import BrowserOnly from '@docusaurus/BrowserOnly';

<BrowserOnly>
{() => {
/* Something that should be excluded during build process prerendering. */
}}
</BrowserOnly>;
function MyComponent() {
return <BrowserOnly>
{() => {
// Something that should be excluded during build process prerendering.
}}
</BrowserOnly>;
}
```

## Hooks
Expand Down

0 comments on commit 63ee326

Please sign in to comment.