Skip to content

Commit 04a1eb4

Browse files
website: add 0.22 to version selector, sync next with 0.22 (#3960)
1 parent 8211024 commit 04a1eb4

File tree

164 files changed

+1310
-917
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

164 files changed

+1310
-917
lines changed

website/i18n/ja/docusaurus-plugin-content-docs/current/advanced-topics/children.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ pub struct ListItemProps {
107107
value: String,
108108
}
109109

110-
#[function_component]
110+
#[component]
111111
fn ListItem(props: &ListItemProps) -> Html {
112112
let ListItemProps { value } = props.clone();
113113
html! {
@@ -122,7 +122,7 @@ pub struct Props {
122122
pub children: ChildrenWithProps<ListItem>,
123123
}
124124

125-
#[function_component]
125+
#[component]
126126
fn List(props: &Props) -> Html {
127127
let modified_children = props.children.iter().map(|mut item| {
128128
let mut props = Rc::make_mut(&mut item.props);

website/i18n/ja/docusaurus-plugin-content-docs/current/advanced-topics/portals.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ pub struct ModalProps {
2222
pub children: Html,
2323
}
2424

25-
#[function_component]
25+
#[component]
2626
fn Modal(props: &ModalProps) -> Html {
2727
let modal_host = gloo::utils::document()
2828
.get_element_by_id("modal_host")

website/i18n/ja/docusaurus-plugin-content-docs/current/advanced-topics/server-side-rendering.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Yewコンポーネントをサーバーサイドでレンダリングするに
2424
use yew::prelude::*;
2525
use yew::ServerRenderer;
2626

27-
#[function_component]
27+
#[component]
2828
fn App() -> Html {
2929
html! {<div>{"Hello, World!"}</div>}
3030
}
@@ -112,7 +112,7 @@ SSR出力(静的HTML)をブラウザが初期レンダリングした後、
112112
use yew::prelude::*;
113113
use yew::Renderer;
114114

115-
#[function_component]
115+
#[component]
116116
fn App() -> Html {
117117
html! {<div>{"Hello, World!"}</div>}
118118
}
@@ -138,7 +138,7 @@ Yewは `yew::LocalServerRenderer` を使用してシングルスレッドでの
138138
use yew::prelude::*;
139139
use yew::LocalServerRenderer;
140140

141-
#[function_component]
141+
#[component]
142142
fn App() -> Html {
143143
use yew_router::prelude::*;
144144

website/i18n/ja/docusaurus-plugin-content-docs/current/advanced-topics/struct-components/hoc.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ struct Theme {
2323
background: String,
2424
}
2525

26-
#[function_component]
26+
#[component]
2727
pub fn App() -> Html {
2828
let ctx = use_state(|| Theme {
2929
foreground: "#000000".to_owned(),
@@ -38,7 +38,7 @@ pub fn App() -> Html {
3838
}
3939

4040
// highlight-start
41-
#[function_component]
41+
#[component]
4242
pub fn ThemedButtonHOC() -> Html {
4343
let theme = use_context::<Theme>().expect("no ctx found");
4444

website/i18n/ja/docusaurus-plugin-content-docs/current/concepts/contexts.mdx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ description: 'コンテキストを使用して深くネストされたデータ
1919
以下の例を考えてみましょう。これは props を介してテーマを渡しています:
2020

2121
```rust
22-
use yew::{html, Component, Context, Html, Properties, function_component};
22+
use yew::{html, Component, Context, Html, Properties, component};
2323

2424
#[derive(Clone, PartialEq)]
2525
pub struct Theme {
@@ -32,7 +32,7 @@ pub struct NavbarProps {
3232
theme: Theme,
3333
}
3434

35-
#[function_component]
35+
#[component]
3636
fn Navbar(props: &NavbarProps) -> Html {
3737
html! {
3838
<div>
@@ -52,22 +52,22 @@ pub struct ThemeProps {
5252
children: Html,
5353
}
5454

55-
#[function_component]
55+
#[component]
5656
fn Title(_props: &ThemeProps) -> Html {
5757
html! {
5858
// impl
5959
}
6060
}
6161

62-
#[function_component]
62+
#[component]
6363
fn NavButton(_props: &ThemeProps) -> Html {
6464
html! {
6565
// impl
6666
}
6767
}
6868

6969
/// アプリのルート
70-
#[function_component]
70+
#[component]
7171
fn App() -> Html {
7272
let theme = Theme {
7373
foreground: "yellow".to_owned(),
@@ -102,7 +102,7 @@ struct Theme {
102102
}
103103

104104
/// メインコンポーネント
105-
#[function_component]
105+
#[component]
106106
pub fn App() -> Html {
107107
let ctx = use_state(|| Theme {
108108
foreground: "#000000".to_owned(),
@@ -121,7 +121,7 @@ pub fn App() -> Html {
121121

122122
/// ツールバー
123123
/// このコンポーネントはコンテキストにアクセスできます。
124-
#[function_component]
124+
#[component]
125125
pub fn Toolbar() -> Html {
126126
html! {
127127
<div>
@@ -133,7 +133,7 @@ pub fn Toolbar() -> Html {
133133
/// `Toolbar` 内に配置されたボタン
134134
/// このコンポーネントは、コンポーネントツリー内の `ThemeContextProvider` の子コンポーネントであるため、
135135
/// コンテキストにアクセスできます。
136-
#[function_component]
136+
#[component]
137137
pub fn ThemedButton() -> Html {
138138
let theme = use_context::<Theme>().expect("no ctx found");
139139

website/i18n/ja/docusaurus-plugin-content-docs/current/concepts/function-components/callbacks.mdx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,14 @@ let result = cb.emit(String::from("Bob")); // コールバック関数を呼び
2222
yew で一般的なパターンは、コールバック関数を作成し、それをプロパティとして子コンポーネントに渡すことです。
2323

2424
```rust
25-
use yew::{function_component, html, Html, Properties, Callback};
25+
use yew::{component, html, Html, Properties, Callback};
2626

2727
#[derive(Properties, PartialEq)]
2828
pub struct Props {
2929
pub on_name_entry: Callback<String>,
3030
}
3131

32-
#[function_component]
32+
#[component]
3333
fn HelloWorld(props: &Props) -> Html {
3434

3535
props.on_name_entry.emit(String::from("Bob"));
@@ -38,7 +38,7 @@ fn HelloWorld(props: &Props) -> Html {
3838
}
3939

4040
// 次にプロパティ (Props) を提供します
41-
#[function_component]
41+
#[component]
4242
fn App() -> Html {
4343
let on_name_entry: Callback<String> = Callback::from(move |name: String| {
4444
let greeting = format!("Hey, {}!", name);
@@ -57,9 +57,9 @@ fn App() -> Html {
5757
例えば、ここではユーザーがボタンをクリックしたときに呼び出されるコールバック関数を定義します:
5858

5959
```rust
60-
use yew::{function_component, html, Html, Properties, Callback};
60+
use yew::{component, html, Html, Properties, Callback};
6161

62-
#[function_component]
62+
#[component]
6363
fn App() -> Html {
6464
let onclick = Callback::from(move |_| {
6565
let greeting = String::from("Hi there");

website/i18n/ja/docusaurus-plugin-content-docs/current/concepts/function-components/children.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ title: '子要素 (Children)'
55
`Children` は特別なプロパティタイプで、HTMLの子要素のようにネストされた `Html` を受け取ることができます。
66

77
```rust
8-
use yew::{function_component, html, Html, Properties};
8+
use yew::{component, html, Html, Properties};
99

10-
#[function_component]
10+
#[component]
1111
fn App() -> Html {
1212
html! {
1313
// highlight-start
@@ -25,7 +25,7 @@ pub struct Props {
2525
pub children: Html, // `children` キーは重要です!
2626
}
2727

28-
#[function_component]
28+
#[component]
2929
fn HelloWorld(props: &Props) -> Html {
3030
html! {
3131
<div class="very-stylized-container">

website/i18n/ja/docusaurus-plugin-content-docs/current/concepts/function-components/generics.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
---
22
title: 'ジェネリックコンポーネント'
3-
description: '関数コンポーネントの #[function_component] 属性'
3+
description: '関数コンポーネントの #[component] 属性'
44
---
55

66
import Tabs from '@theme/Tabs'
77
import TabItem from '@theme/TabItem'
88

9-
`#[function_component]` 属性は、ジェネリックコンポーネントを作成するためのジェネリック関数にも適用されます。
9+
`#[component]` 属性は、ジェネリックコンポーネントを作成するためのジェネリック関数にも適用されます。
1010

1111
```rust
1212
use std::fmt::Display;
13-
use yew::{function_component, html, Properties, Html};
13+
use yew::{component, html, Properties, Html};
1414

1515
#[derive(Properties, PartialEq)]
1616
pub struct Props<T>
@@ -20,7 +20,7 @@ where
2020
data: T,
2121
}
2222

23-
#[function_component]
23+
#[component]
2424
pub fn MyGenericComponent<T>(props: &Props<T>) -> Html
2525
where
2626
T: PartialEq + Clone + Into<Html>,

website/i18n/ja/docusaurus-plugin-content-docs/current/concepts/function-components/hooks/custom-hooks.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use gloo::utils::window;
1515
use std::mem::drop;
1616

1717

18-
#[function_component(ShowStorageChanged)]
18+
#[component(ShowStorageChanged)]
1919
pub fn show_storage_changed() -> Html {
2020
let state_storage_changed = use_state(|| false);
2121

website/i18n/ja/docusaurus-plugin-content-docs/current/concepts/function-components/introduction.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,18 +27,18 @@ slug: /concepts/function-components
2727

2828
## 関数コンポーネントの作成
2929

30-
関数コンポーネントを作成するには、関数に `#[function_component]` 属性を追加します。慣例として、関数の名前は PascalCase を使用し、`html!` マクロ内の通常の html 要素と対比させます。
30+
関数コンポーネントを作成するには、関数に `#[component]` 属性を追加します。慣例として、関数の名前は PascalCase を使用し、`html!` マクロ内の通常の html 要素と対比させます。
3131

3232
```rust
33-
use yew::{function_component, html, Html};
33+
use yew::{component, html, Html};
3434

35-
#[function_component]
35+
#[component]
3636
fn HelloWorld() -> Html {
3737
html! { "Hello world" }
3838
}
3939

4040
// そして他の場所で、`html!` 内でコンポーネントを使用できます
41-
#[function_component]
41+
#[component]
4242
fn App() -> Html {
4343
html! { <HelloWorld /> }
4444
}

0 commit comments

Comments
 (0)