Skip to content

Commit 24bf7a0

Browse files
committed
Translate 'Writing Markup with JSX' page to Gujarati
- Complete translation of writing-markup-with-jsx.md - All explanations, examples, and UI text translated - Code examples and technical terms preserved - Maintains original structure and formatting
1 parent 6355a23 commit 24bf7a0

File tree

1 file changed

+52
-97
lines changed

1 file changed

+52
-97
lines changed
Lines changed: 52 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,20 @@
1-
---
2-
title: Writing Markup with JSX
3-
---
1+
# JSX સાથે માર્કઅપ લખવું {/*writing-markup-with-jsx*/}
42

5-
<Intro>
6-
7-
*JSX* is a syntax extension for JavaScript that lets you write HTML-like markup inside a JavaScript file. Although there are other ways to write components, most React developers prefer the conciseness of JSX, and most codebases use it.
3+
*JSX* એ JavaScript માટેનું syntax extension છે જે તમને JavaScript ફાઇલની અંદર HTML-જેવું માર્કઅપ લખવાની મંજૂરી આપે છે. React components લખવાની અન્ય રીતો પણ છે, પરંતુ મોટાભાગના React developers JSX ની સુવિધાને પસંદ કરે છે, અને મોટાભાગના codebases તેનો ઉપયોગ કરે છે.
84

9-
</Intro>
5+
<Intro>
106

11-
<YouWillLearn>
7+
તમે શીખશો કે:
128

13-
* Why React mixes markup with rendering logic
14-
* How JSX is different from HTML
15-
* How to display information with JSX
9+
* React શા માટે markup અને rendering logic ને મિક્સ કરે છે
10+
* JSX HTML થી કેવી રીતે અલગ છે
11+
* JSX સાથે information કેવી રીતે display કરવી
1612

17-
</YouWillLearn>
13+
</Intro>
1814

19-
## JSX: Putting markup into JavaScript {/*jsx-putting-markup-into-javascript*/}
15+
## JSX: JavaScript માં markup મૂકવું {/*jsx-putting-markup-into-javascript*/}
2016

21-
The Web has been built on HTML, CSS, and JavaScript. For many years, web developers kept content in HTML, design in CSS, and logic in JavaScript—often in separate files! Content was marked up inside HTML while the page's logic lived separately in JavaScript:
17+
Web લાંબા સમયથી HTML, CSS અને JavaScript પર બનાવવામાં આવ્યું છે. વર્ષો સુધી, web developers content ને HTML માં, design ને CSS માં, અને logic ને JavaScript માં—ઘણીવાર અલગ ફાઇલોમાં રાખતા હતા! Content HTML ની અંદર markup કરવામાં આવતું હતું જ્યારે page નું logic JavaScript માં અલગથી રહેતું હતું:
2218

2319
<DiagramGroup>
2420

@@ -36,37 +32,33 @@ JavaScript
3632

3733
</DiagramGroup>
3834

39-
But as the Web became more interactive, logic increasingly determined content. JavaScript was in charge of the HTML! This is why **in React, rendering logic and markup live together in the same place—components.**
35+
પરંતુ જેમ જેમ Web વધુ interactive બન્યું, તેમ તેમ logic વધુને વધુ content ને નિયંત્રિત કરવા લાગ્યું. JavaScript HTML ના હવાલે હતું! આ કારણથી **React માં, rendering logic અને markup એક જ જગ્યાએ રહે છે—components માં.**
4036

4137
<DiagramGroup>
4238

43-
<Diagram name="writing_jsx_sidebar" height={330} width={325} alt="React component with HTML and JavaScript from previous examples mixed. Function name is Sidebar which calls the function isLoggedIn, highlighted in yellow. Nested inside the function highlighted in purple is the p tag from before, and a Form tag referencing the component shown in the next diagram.">
39+
<Diagram name="writing_jsx_sidebar" height={330} width={325} alt="React component with HTML and JavaScript from previous examples mixed. Function name is Sidebar which calls the function isLoggedIn, highlighted in yellow, followed by conditional logic also highlighted in yellow. Nested inside a div highlighted in purple are the tags from before, replaced by three React components: NavLinks, ChatList, ContactList.">
4440

4541
`Sidebar.js` React component
4642

4743
</Diagram>
4844

49-
<Diagram name="writing_jsx_form" height={330} width={325} alt="React component with HTML and JavaScript from previous examples mixed. Function name is Form containing two handlers onClick and onSubmit highlighted in yellow. Following the handlers is HTML highlighted in purple. The HTML contains a form element with a nested input element, each with an onClick prop.">
45+
<Diagram name="writing_jsx_form" height={330} width={325} alt="React component with HTML and JavaScript from previous examples mixed. Function name is Form highlighted in yellow containing two handlers onClick and onSubmit highlighted in yellow. Following the handlers is HTML highlighted in purple. The HTML contains a form element with a nested input element, both highlighted in purple.">
5046

5147
`Form.js` React component
5248

5349
</Diagram>
5450

5551
</DiagramGroup>
5652

57-
Keeping a button's rendering logic and markup together ensures that they stay in sync with each other on every edit. Conversely, details that are unrelated, such as the button's markup and a sidebar's markup, are isolated from each other, making it safer to change either of them on their own.
58-
59-
Each React component is a JavaScript function that may contain some markup that React renders into the browser. React components use a syntax extension called JSX to represent that markup. JSX looks a lot like HTML, but it is a bit stricter and can display dynamic information. The best way to understand this is to convert some HTML markup to JSX markup.
53+
Button ના rendering logic અને markup ને એકસાથે રાખવાથી તેઓ દરેક edit પર એકબીજા સાથે sync માં રહે છે. ઉલટાનું, વિગતો જે સંબંધિત નથી, જેમ કે button નું markup અને sidebar નું markup, એકબીજાથી isolated હોય છે, જેનાથી કોઈપણને બદલવું વધુ સુરક્ષિત બને છે.
6054

61-
<Note>
55+
દરેક React component એક JavaScript function છે જેમાં થોડું markup હોઈ શકે છે જે React browser માં render કરે છે. React components એક syntax extension વાપરે છે જેને JSX કહેવાય છે markup represent કરવા માટે. JSX HTML જેવું દેખાય છે, પરંતુ તે થોડું વધુ strict છે અને dynamic information display કરી શકે છે.
6256

63-
JSX and React are two separate things. They're often used together, but you *can* [use them independently](https://reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html#whats-a-jsx-transform) of each other. JSX is a syntax extension, while React is a JavaScript library.
57+
આ સમજવાનો શ્રેષ્ઠ રસ્તો એ છે કે HTML markup ને JSX markup માં convert કરવો:
6458

65-
</Note>
59+
## HTML ને JSX માં convert કરવું {/*converting-html-to-jsx*/}
6660

67-
## Converting HTML to JSX {/*converting-html-to-jsx*/}
68-
69-
Suppose that you have some (perfectly valid) HTML:
61+
ધારો કે તમારી પાસે આ (સંપૂર્ણ valid) HTML છે:
7062

7163
```html
7264
<h1>Hedy Lamarr's Todos</h1>
@@ -82,7 +74,7 @@ Suppose that you have some (perfectly valid) HTML:
8274
</ul>
8375
```
8476

85-
And you want to put it into your component:
77+
અને તમે તેને તમારા component માં મૂકવા માંગો છો:
8678

8779
```js
8880
export default function TodoList() {
@@ -92,15 +84,14 @@ export default function TodoList() {
9284
}
9385
```
9486

95-
If you copy and paste it as is, it will not work:
96-
87+
જો તમે તેને copy અને paste કરશો, તો તે કામ કરશે નહીં:
9788

9889
<Sandpack>
9990

10091
```js
10192
export default function TodoList() {
10293
return (
103-
// This doesn't quite work!
94+
// This doesn't work!
10495
<h1>Hedy Lamarr's Todos</h1>
10596
<img
10697
src="https://i.imgur.com/yXOvdOSs.jpg"
@@ -116,27 +107,23 @@ export default function TodoList() {
116107
}
117108
```
118109
119-
```css
120-
img { height: 90px }
121-
```
122-
123110
</Sandpack>
124111
125-
This is because JSX is stricter and has a few more rules than HTML! If you read the error messages above, they'll guide you to fix the markup, or you can follow the guide below.
112+
આ કારણે કે JSX HTML કરતાં વધુ strict છે અને તેના થોડા વધુ નિયમો છે! જો તમે ઉપરના error messages વાંચશો, તો તેઓ તમને markup ને fix કરવા માટે guide કરશે, અથવા તમે નીચેની guide ને follow કરી શકો છો.
126113
127114
<Note>
128115
129-
Most of the time, React's on-screen error messages will help you find where the problem is. Give them a read if you get stuck!
116+
મોટાભાગે, React ની on-screen error messages તમને સમસ્યા શોધવામાં મદદ કરશે. જો તમે અટવાઈ જાઓ તો તેને વાંચો!
130117
131118
</Note>
132119
133-
## The Rules of JSX {/*the-rules-of-jsx*/}
120+
## JSX ના નિયમો {/*the-rules-of-jsx*/}
134121
135-
### 1. Return a single root element {/*1-return-a-single-root-element*/}
122+
### 1. Single root element return કરો {/*1-return-a-single-root-element*/}
136123
137-
To return multiple elements from a component, **wrap them with a single parent tag.**
124+
Component માંથી multiple elements return કરવા માટે, **તેમને single parent tag સાથે wrap કરો.**
138125
139-
For example, you can use a `<div>`:
126+
ઉદાહરણ તરીકે, તમે `<div>` વાપરી શકો છો:
140127
141128
```js {1,11}
142129
<div>
@@ -152,8 +139,7 @@ For example, you can use a `<div>`:
152139
</div>
153140
```
154141
155-
156-
If you don't want to add an extra `<div>` to your markup, you can write `<>` and `</>` instead:
142+
જો તમે તમારા markup માં extra `<div>` ઉમેરવા નથી માંગતા, તો તમે `<>` અને `</>` લખી શકો છો:
157143
158144
```js {1,11}
159145
<>
@@ -169,21 +155,21 @@ If you don't want to add an extra `<div>` to your markup, you can write `<>` and
169155
</>
170156
```
171157
172-
This empty tag is called a *[Fragment.](/reference/react/Fragment)* Fragments let you group things without leaving any trace in the browser HTML tree.
158+
empty tag ને *[Fragment](/reference/react/Fragment)* કહેવાય છે. Fragments તમને DOM tree માં કોઈ trace છોડ્યા વિના વસ્તુઓને group કરવાની મંજૂરી આપે છે.
173159
174160
<DeepDive>
175161
176-
#### Why do multiple JSX tags need to be wrapped? {/*why-do-multiple-jsx-tags-need-to-be-wrapped*/}
162+
#### JSX ને single tag ની જરૂર શા માટે છે? {/*why-do-multiple-jsx-tags-need-to-be-wrapped*/}
177163
178-
JSX looks like HTML, but under the hood it is transformed into plain JavaScript objects. You can't return two objects from a function without wrapping them into an array. This explains why you also can't return two JSX tags without wrapping them into another tag or a Fragment.
164+
JSX HTML જેવું લાગે છે, પરંતુ તેની અંદર તે plain JavaScript objects માં transform થાય છે. તમે function માંથી બે objects ને array માં wrap કર્યા વિના return કરી શકતા નથી. આ સમજાવે છે કે તમે બે JSX tags ને પણ બીજા tag અથવા Fragment માં wrap કર્યા વિના return કરી શકતા નથી.
179165
180166
</DeepDive>
181167
182-
### 2. Close all the tags {/*2-close-all-the-tags*/}
168+
### 2. બધા tags બંધ કરો {/*2-close-all-the-tags*/}
183169
184-
JSX requires tags to be explicitly closed: self-closing tags like `<img>` must become `<img />`, and wrapping tags like `<li>oranges` must be written as `<li>oranges</li>`.
170+
JSX માં બધા tags explicitly બંધ કરવાની જરૂર છે: self-closing tags જેમ કે `<img>` `<img />` બનવા જોઈએ, અને wrapping tags જેમ કે `<li>oranges` `<li>oranges</li>` તરીકે લખવા જોઈએ.
185171
186-
This is how Hedy Lamarr's image and list items look closed:
172+
આ રીતે Hedy Lamarr નું image અને list items બંધ દેખાય છે:
187173
188174
```js {2-6,8-10}
189175
<>
@@ -200,11 +186,11 @@ This is how Hedy Lamarr's image and list items look closed:
200186
</>
201187
```
202188
203-
### 3. camelCase <s>all</s> most of the things! {/*3-camelcase-salls-most-of-the-things*/}
189+
### 3. camelCase લગભગ બધું! {/*3-camelcase-salls-most-of-the-things*/}
204190
205-
JSX turns into JavaScript and attributes written in JSX become keys of JavaScript objects. In your own components, you will often want to read those attributes into variables. But JavaScript has limitations on variable names. For example, their names can't contain dashes or be reserved words like `class`.
191+
JSX JavaScript માં transform થાય છે અને JSX માં લખાયેલા attributes JavaScript objects ની keys બને છે. તમારા પોતાના components માં, તમે ઘણીવાર આ attributes ને variables માં read કરવા માંગશો. પરંતુ JavaScript માં variable names ની limitations છે. ઉદાહરણ તરીકે, તેઓ dashes સમાવી શકતા નથી અથવા `class` જેવા reserved words હોઈ શકતા નથી.
206192
207-
This is why, in React, many HTML and SVG attributes are written in camelCase. For example, instead of `stroke-width` you use `strokeWidth`. Since `class` is a reserved word, in React you write `className` instead, named after the [corresponding DOM property](https://developer.mozilla.org/en-US/docs/Web/API/Element/className):
193+
આ કારણથી, React માં ઘણા HTML અને SVG attributes camelCase માં લખાય છે. ઉદાહરણ તરીકે, `stroke-width` ને બદલે તમે `strokeWidth` વાપરો છો. કારણ કે `class` reserved word છે, React માં તમે તેના બદલે `className` લખો છો, [corresponding DOM property](https://developer.mozilla.org/en-US/docs/Web/API/Element/className) પરથી નામ આપવામાં આવ્યું છે:
208194
209195
```js {4}
210196
<img
@@ -214,19 +200,19 @@ This is why, in React, many HTML and SVG attributes are written in camelCase. Fo
214200
/>
215201
```
216202
217-
You can [find all these attributes in the list of DOM component props.](/reference/react-dom/components/common) If you get one wrong, don't worry—React will print a message with a possible correction to the [browser console.](https://developer.mozilla.org/docs/Tools/Browser_Console)
203+
તમે [આ બધા attributes DOM component props reference માં શોધી શકો છો](/reference/react-dom/components/common). જો તમે કોઈ ખોટું કરો છો, તો ચિંતા કરશો નહીં—React browser console માં સુધારાનું સુઝાવ આપે છે.
218204
219205
<Pitfall>
220206
221-
For historical reasons, [`aria-*`](https://developer.mozilla.org/docs/Web/Accessibility/ARIA) and [`data-*`](https://developer.mozilla.org/docs/Learn/HTML/Howto/Use_data_attributes) attributes are written as in HTML with dashes.
207+
Historical reasons માટે, [`aria-*`](https://developer.mozilla.org/docs/Web/Accessibility/ARIA) અને [`data-*`](https://developer.mozilla.org/docs/Learn/HTML/Howto/Use_data_attributes) attributes HTML માં હોય તેવા dashes સાથે લખાય છે.
222208
223209
</Pitfall>
224210
225-
### Pro-tip: Use a JSX Converter {/*pro-tip-use-a-jsx-converter*/}
211+
### Pro-tip: JSX Converter વાપરો {/*pro-tip-use-a-jsx-converter*/}
226212
227-
Converting all these attributes in existing markup can be tedious! We recommend using a [converter](https://transform.tools/html-to-jsx) to translate your existing HTML and SVG to JSX. Converters are very useful in practice, but it's still worth understanding what is going on so that you can comfortably write JSX on your own.
213+
Existing markup માંના આ બધા attributes ને convert કરવું કંટાળાજનક હોઈ શકે છે! અમે existing HTML અને SVG ને JSX માં translate કરવા માટે [converter](https://transform.tools/html-to-jsx) વાપરવાની ભલામણ કરીએ છીએ. Converters practice માં ખૂબ જ ઉપયોગી છે, પરંતુ તમે JSX પર તમારી જાતે comfortably લખી શકો તે માટે શું થઈ રહ્યું છે તે સમજવું હજુ પણ મહત્વપૂર્ણ છે.
228214
229-
Here is your final result:
215+
આ તમારું અંતિમ પરિણામ છે:
230216
231217
<Sandpack>
232218
@@ -258,21 +244,19 @@ img { height: 90px }
258244

259245
<Recap>
260246

261-
Now you know why JSX exists and how to use it in components:
247+
હવે તમે જાણો છો કે JSX શા માટે અસતિત્વ ધરાવે છે અને components માં તેનો ઉપયોગ કેવી રીતે કરવો:
262248

263-
* React components group rendering logic together with markup because they are related.
264-
* JSX is similar to HTML, with a few differences. You can use a [converter](https://transform.tools/html-to-jsx) if you need to.
265-
* Error messages will often point you in the right direction to fixing your markup.
249+
* React components rendering logic ને markup સાથે group કરે છે કારણ કે તેઓ related છે.
250+
* JSX HTML જેવું છે, પરંતુ થોડા differences સાથે. જરૂર હોય તો તમે [converter](https://transform.tools/html-to-jsx) વાપરી શકો છો.
251+
* Error messages ઘણીવાર તમને markup ને fix કરવાની યોગ્ય દિશા આપશે.
266252

267253
</Recap>
268254

269-
270-
271255
<Challenges>
272256

273-
#### Convert some HTML to JSX {/*convert-some-html-to-jsx*/}
257+
#### HTML ને JSX માં convert કરો {/*convert-some-html-to-jsx*/}
274258

275-
This HTML was pasted into a component, but it's not valid JSX. Fix it:
259+
HTML એક component માં paste કરવામાં આવ્યું હતું, પરંતુ તે valid JSX નથી. તેને fix કરો:
276260

277261
<Sandpack>
278262

@@ -291,24 +275,9 @@ export default function Bio() {
291275
}
292276
```
293277

294-
```css
295-
.intro {
296-
background-image: linear-gradient(to left, violet, indigo, blue, green, yellow, orange, red);
297-
background-clip: text;
298-
color: transparent;
299-
-webkit-background-clip: text;
300-
-webkit-text-fill-color: transparent;
301-
}
302-
303-
.summary {
304-
padding: 20px;
305-
border: 10px solid gold;
306-
}
307-
```
308-
309278
</Sandpack>
310279

311-
Whether to do it by hand or using the converter is up to you!
280+
તમે તેને manually કરવા માંગો છો કે converter વાપરવા માંગો છો તે તમારા પર નિર્ભર છે!
312281

313282
<Solution>
314283

@@ -323,31 +292,17 @@ export default function Bio() {
323292
</div>
324293
<p className="summary">
325294
You can find my thoughts here.
326-
<br /><br />
295+
<br />
296+
<br />
327297
<b>And <i>pictures</i></b> of scientists!
328298
</p>
329299
</div>
330300
);
331301
}
332302
```
333303

334-
```css
335-
.intro {
336-
background-image: linear-gradient(to left, violet, indigo, blue, green, yellow, orange, red);
337-
background-clip: text;
338-
color: transparent;
339-
-webkit-background-clip: text;
340-
-webkit-text-fill-color: transparent;
341-
}
342-
343-
.summary {
344-
padding: 20px;
345-
border: 10px solid gold;
346-
}
347-
```
348-
349304
</Sandpack>
350305

351306
</Solution>
352307

353-
</Challenges>
308+
</Challenges>

0 commit comments

Comments
 (0)