Skip to content

Instantly share code, notes, and snippets.

@anartzdev
Created February 5, 2024 09:40
Show Gist options
  • Save anartzdev/f701c9d718af6655f6eb660198a468e4 to your computer and use it in GitHub Desktop.
Save anartzdev/f701c9d718af6655f6eb660198a468e4 to your computer and use it in GitHub Desktop.
export const Title = () => {
const name = 'Anartz';
return <h1>{name}</h1>;
};
export const Age = () => {
const age = 37;
return (
<p>
{age > 40
? 'Como "tienes más de 40 años", tienes 18 años y más de 22 años de experiencia ;)'
: `Eres joven, todavía tienes ${age} años y te faltan ${
40 - age
} para volver a cumplir 18 años ;)`}
</p>
);
};
export const Hobbies = () => {
return (
<ul>
{['leer', 'deporte', 'videojuegos'].map((value, index) => (
<li key={index + '_hobby'}>
{index + 1} - {value}
</li>
))}
</ul>
);
};
// Componente principal
export default component$(() => {
return (
<>
<Title />
<br />
<Age />
<Hobbies />
</>
);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment