Skip to content
This repository was archived by the owner on Jan 20, 2025. It is now read-only.

Commit daa8f15

Browse files
authored
Merge pull request #64 from 2ur1/docs/static-query
Translation docs/static-query into Japanese
2 parents 789a777 + ad5e6c5 commit daa8f15

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

docs/docs/static-query.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
---
2-
title: Querying Data in Components using StaticQuery
2+
title: StaticQueryを使用したコンポーネントでのデータ取得
33
---
44

5-
Gatsby v2 introduces `StaticQuery`, a new API that allows components to retrieve data via a GraphQL query.
5+
Gatsby v2 では、`StaticQuery` という GraphQL クエリーを介して、コンポーネントがデータを取得できる新しい API が導入されました。
66

7-
In this guide, you'll see an example using `StaticQuery`, and learn about [the difference between a StaticQuery and a page query](#how-staticquery-differs-from-page-query).
7+
このガイドでは、`StaticQuery` を使用した例を参照し、[StaticQuery とページクエリーの違い](#how-staticquery-differs-from-page-query)について学習します。
88

9-
## How to use `StaticQuery` in components
9+
## コンポーネントでの `StaticQuery` の使用例
1010

1111
<EggheadEmbed
1212
lessonLink="https://egghead.io/lessons/gatsby-load-data-using-graphql-queries-directly-in-a-gatsby-v2-component-with-staticquery"
13-
lessonTitle="Load Data using GraphQL Queries Directly in a Gatsby v2 Component with StaticQuery"
13+
lessonTitle="Load Data using GraphQL Queries Directly in a Gatsby v2 Component with StaticQuery(英語版)"
1414
/>
1515

16-
### Basic example
16+
### 基本的な例
1717

18-
Here is an example of a `Header` component using `StaticQuery`:
18+
`StaticQuery` を使用した `Header` コンポーネントの例を次に示します。
1919

2020
```jsx:title=src/components/header.js
2121
import React from "react"
@@ -41,15 +41,15 @@ export default () => (
4141
)
4242
```
4343

44-
By using `StaticQuery`, you can colocate a component with its data. It is no longer required to, say, pass data down from `Layout` to `Header`.
44+
`StaticQuery` を使用することで、コンポーネントとそのデータを同じ場所に配置できます。たとえば、`Layout` から `Header` にデータを渡す必要はなくなります。
4545

4646
### useStaticQuery
4747

48-
There's also a React hooks version of StaticQuery: check out the documentation on [`useStaticQuery`](/docs/use-static-query/)
48+
StaticQuery には React Hooks バージョンもあります。詳しくは、[`useStaticQuery`](/docs/use-static-query/) をご覧ください。
4949

50-
### Typechecking
50+
### 型チェック
5151

52-
With the above pattern, you lose the ability to typecheck with PropTypes. To regain typechecking while achieving the same result, you can change the component to:
52+
上記のパターンを使用すると、PropTypes で型チェックする機能が失われます。同じ結果を得ながら型チェックを行うには、コンポーネントを次のように変更します。
5353

5454
```jsx:title=src/components/header.js
5555
import React from "react"
@@ -88,10 +88,10 @@ Header.propTypes = {
8888
}
8989
```
9090

91-
## How StaticQuery differs from page query
91+
## StaticQuery とページクエリーの違い
9292

93-
StaticQuery can do most of the things that page query can, including fragments. The main differences are:
93+
StaticQuery は(フラグメントを含む)ページクエリーが行えることのほとんどを行えます。主な違いは次のとおりです。
9494

95-
- page queries can accept variables (via `pageContext`) but can only be added to _page_ components
96-
- StaticQuery does not accept variables (hence the name "static"), but can be used in _any_ component, including pages
97-
- StaticQuery does not work with raw React.createElement calls; please use JSX, e.g. `<StaticQuery />`
95+
- ページクエリーは(`pageContext` を介して)変数を受け入れることができますが、追加できるのは**ページ**コンポーネントだけです。
96+
- StaticQuery は変数を受け入れません(そのため「static」という名前です)が、ページを含む**任意の**コンポーネントで使用できます。
97+
- StaticQuery は、そのままの React.createElement 呼び出しでは機能しません。たとえば、JSX を使用してください。例:`<StaticQuery />`

0 commit comments

Comments
 (0)