Component
React applications are built from independent pieces of UI called components.
This page hasn't been translated yet — shown in its original language:Català
Introduction
A React component is a TypeScript function to which you can add TSX.
Create a project with Deno
deno init --npm vite --template react-swc-ts react-componentComponent
Define the Greeting component which is used by the App component:
return
}
return
}Els components de React són funcions regulars de TypeScript, però els seus noms han de començar amb lletra majúscula o no funcionaran!
El component Greeting està nidat dins del component App.
Pots afegir tants components Greeting com vulguis dins del component App:
return
</>
)
}
return
}Al final el que el navegador veu és això:
Hello X
Hello X
Hello XYou're reading a preview.
Sign in to read the full article. Any account opens 4 free articles a month; students and teachers read their course pages without limit.
Sign in