-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJSXOuterElements.js
More file actions
33 lines (27 loc) · 865 Bytes
/
JSXOuterElements.js
File metadata and controls
33 lines (27 loc) · 865 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// una expresión JSX debe tener exactamente un elemento externo.
const paragraphs = (
<div id="i-am-the-outermost-element">
<p>I am a paragraph.</p>
<p>I, too, am a paragraph.</p>
</div>
);
// este código no funcionará
// const paragraphs = (
// <p>I am a paragraph.</p>
// <p>I, too, am a paragraph.</p>
// );
/* La primera etiqueta de apertura y la etiqueta de cierre final
de una expresión JSX deben pertenecer al mismo elemento JSX! */}
/*Si observa que una expresión JSX tiene múltiples elementos externos,
la solución generalmente es simple: ajuste la expresión JSX en a <div></div>*/
const blog = (
<div>
<img src="pics/192940u73.jpg" />
<h1>
Welcome to Dan's Blog!
</h1>
<article>
Wow I had the tastiest sandwich today. I <strong>literally</strong> almost freaked out.
</article>
</div>
);