A Pen by José Manuel Lucas on CodePen.
Created
April 7, 2018 19:12
-
-
Save jmlweb/9e27805dcc31d2b6b4002cde35601bde to your computer and use it in GitHub Desktop.
Ejemplo simple de componente React / Curso Keepcoding
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const SimpleComponent = ({ title, children }) => ( | |
<div className="simpleComponent"> | |
<h1 className="title">{title}</h1> | |
<div className="content"> | |
{children} | |
</div> | |
</div> | |
); | |
const ComposedComponent = () => ( | |
<div className="composedComponent"> | |
<SimpleComponent title="Primer capítulo del curso de React"> | |
<p>Mediante las propiedades "prop" definimos cómo se debe mostrar nuestro componente</p> | |
<p>El contenido pasa como prop "children"</p> | |
</Simplecomponent> | |
<SimpleComponent title="Segundo capítulo del curso de React"> | |
<ul> | |
<li>No es necesario que el contenido siga la misma estructura</li> | |
<li>Hay algunas palabras reservadas en JS, entre ellas "class", por lo que en | |
JSX, el atributo equivalente es "className"</li> | |
</ul> | |
</Simplecomponent> | |
</div> | |
); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/16.2.0/umd/react.development.js"></script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment