Skip to content

Commit c3199de

Browse files
committed
translate some lines on your-first-component file
1 parent 7f14ac5 commit c3199de

1 file changed

Lines changed: 14 additions & 14 deletions

File tree

src/content/learn/your-first-component.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -82,27 +82,27 @@ img { height: 200px; }
8282

8383
دستور `export default` یک پیشوند در زبان جاوااسکریپت است [standard JavaScript syntax](https://developer.mozilla.org/docs/web/javascript/reference/statements/export) (نه فقط در React), به شما اجازه میدهد که تابع اصلی خود را در فایل مشخص کنید و در فایل دیگر import کنید. (درباره Import بدانید [Importing and Exporting Components](/learn/importing-and-exporting-components)!)
8484

85-
### Step 2: تعریف و ایجاد تابع {/*step-2-define-the-function*/}
85+
### قدم دوم: ساخت و تعریف توابع {/*step-2-define-the-function*/}
8686

8787
با دستور `function Profile() { }` شما میتوانید یک تابع جاوااسکریپتی با نام `Profile` تعریف کنید.
8888

8989
<Pitfall>
9090

91-
React components are regular JavaScript functions, but **their names must start with a capital letter** or they won't work!
91+
کامپوننت های React همان توابع معمولی در جاوااسکریپت هستند, با این تفاوت که باید **حرف اول اسم آن از حروف بزرگ باشد** وگرنه ارور میدهد!
9292

9393
</Pitfall>
9494

95-
### Step 3: Add markup {/*step-3-add-markup*/}
95+
### قدم سوم: اضافه کردن تگ HTML {/*step-3-add-markup*/}
9696

97-
The component returns an `<img />` tag with `src` and `alt` attributes. `<img />` is written like HTML, but it is actually JavaScript under the hood! This syntax is called [JSX](/learn/writing-markup-with-jsx), and it lets you embed markup inside JavaScript.
97+
کامپوننت زیر یک تگ `<img />` را به همراه اتریبیوت های `src` و `alt` برمیگرداند. `<img />` مانند HTML نوشته میشود ولی این یک دستور جاوااسکریپتی است! این سینتکس [JSX](/learn/writing-markup-with-jsx) نام دارد, و به شما اجازه میدهد تا تگ های HTML را مستقیما در یک فایل جاوااسکریپت بنویسید.
9898

99-
Return statements can be written all on one line, as in this component:
99+
دستور return را هم میتوان به این صورت در یک خط نوشت:
100100

101101
```js
102102
return <img src="https://i.imgur.com/MK3eW3As.jpg" alt="Katherine Johnson" />;
103103
```
104104

105-
But if your markup isn't all on the same line as the `return` keyword, you must wrap it in a pair of parentheses:
105+
اما اگر نمیتوانید کل تگ های HTML را در یک خط بنویسید فقط کافیست بعد از دستور return یک جفت پرانتز قرار بدهید و تگ هارا داخل آن بنویسید:
106106

107107
```js
108108
return (
@@ -114,13 +114,13 @@ return (
114114

115115
<Pitfall>
116116

117-
Without parentheses, any code on the lines after `return` [will be ignored](https://stackoverflow.com/questions/2846283/what-are-the-rules-for-javascripts-automatic-semicolon-insertion-asi)!
117+
بدون پرانتز, خط های بعد از دستور `return` [نادیده گرفته میشوند](https://stackoverflow.com/questions/2846283/what-are-the-rules-for-javascripts-automatic-semicolon-insertion-asi)!
118118

119119
</Pitfall>
120120

121-
## Using a component {/*using-a-component*/}
121+
## استفاده از یک کامپوننت {/*using-a-component*/}
122122

123-
Now that you've defined your `Profile` component, you can nest it inside other components. For example, you can export a `Gallery` component that uses multiple `Profile` components:
123+
بعد از اینکه کامپونت `Profile` خود را ساخته اید, الان وقت آن است که همان کامپوننت را در میان کامپوننت های دیگر قرار بدهید. به عنوان مثال شما میتوانید کامپوننت `Gallery` را به همراه چند کامپوننت `Profile` که داخل آن استفاده شده است را export بگیرید:
124124

125125
<Sandpack>
126126

@@ -152,14 +152,14 @@ img { margin: 0 10px 10px 0; height: 90px; }
152152

153153
</Sandpack>
154154

155-
### What the browser sees {/*what-the-browser-sees*/}
155+
### از دید مرورگر ها چه میگذرد {/*what-the-browser-sees*/}
156156

157-
Notice the difference in casing:
157+
به تفاوت های زیر توجه کنید:
158158

159-
* `<section>` is lowercase, so React knows we refer to an HTML tag.
160-
* `<Profile />` starts with a capital `P`, so React knows that we want to use our component called `Profile`.
159+
* `<section>` با حرف کوچک شروع شده پس React میداند که این یک تگ HTML است.
160+
* `<Profile />` با حرف بزرگ `P` شروع شده پس ریکت متوجه میشود که ما کامپوننتی به نام `Profile` داریم. پس باید رندر شود.
161161

162-
And `Profile` contains even more HTML: `<img />`. In the end, this is what the browser sees:
162+
و کامپوننت Profile شامل یکسری تگ HTML است: `<img />`. و درآخر, کد زیر چیزی هست که مرورگر میبیند:
163163

164164
```html
165165
<section>

0 commit comments

Comments
 (0)