[ci] yarn format
This commit is contained in:
parent
1bab906539
commit
86694cb8b8
1 changed files with 3 additions and 7 deletions
10
docs/api.md
10
docs/api.md
|
@ -150,17 +150,13 @@ Astro will generate an RSS 2.0 feed at `/feed/[collection].xml` (for example, `/
|
|||
|
||||
All ESM modules include a `import.meta` property. Astro adds `import.meta.env` through [Snowpack](https://www.snowpack.dev/).
|
||||
|
||||
__import.meta.env.SSR__ can be used to know when rendering on the server. Some times you might want different logic, for example a component that should only be rendered in the client:
|
||||
**import.meta.env.SSR** can be used to know when rendering on the server. Some times you might want different logic, for example a component that should only be rendered in the client:
|
||||
|
||||
```jsx
|
||||
import { h } from 'preact';
|
||||
|
||||
export default function() {
|
||||
return (
|
||||
import.meta.env.SSR ?
|
||||
<div class="spinner"></div> :
|
||||
<FancyComponent />
|
||||
)
|
||||
export default function () {
|
||||
return import.meta.env.SSR ? <div class="spinner"></div> : <FancyComponent />;
|
||||
}
|
||||
```
|
||||
|
||||
|
|
Loading…
Reference in a new issue