-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating

Learn React with TypeScript
By :

In this section, we will create a React component and reference this within the App
component.
We are going to create a component that displays an alert, which we will simply call Alert
. It will consist of an icon, a heading, and a message.
Note
A React component name must start with a capital letter. If a component name starts with a lowercase letter, it is treated as a DOM element and won’t render properly.
Carry out the following steps to create the component in the project:
src
folder called Alert.jsx
.Note
The filename for component files isn’t important to React or the React transpiler. It is common practice to use the same name as the component, either in Pascal or snake case. However, the file extension must be .js
or .jsx
for React transpilers to recognize these as React components.
Alert.jsx
file and enter the following code in it...