Creando nuestro primer
componente
Vamos a crear los 3 botones usando un componente
🚨 El nombre del de los componentes debe implementar pascal
case todos las palabras inician en mayúscula.
import React from "react";
import { createRoot } from "react-dom/client";
const root = createRoot(document.getElementById("root"));
const SpecialButton = ({ text }) => {
return (
<button>
<svg
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
style={{ fill: "rgba(0, 0, 0, 1)", transform: "" }}
>
<path d="M4 21h1V8H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2zM20 8
</svg>
{text}
</button>
);
};
root.render(
Creando nuestro primer componente 1
<React.Fragment>
<SpecialButton text="Button 1" />
<SpecialButton text="Button 2" />
<SpecialButton text="Button 3" />
</React.Fragment>
);
Salida
Creando nuestro primer componente 2