JSX is a syntex extensin created by Facebook. It makes us easy to understand the code and makes the code easy to maintain.
- Easy to maintain
- Secure
- Easy to debug
The type
attribute in the script tag defines the type of script that we we want to run inside our app.
type
attribute can be of the following types:
text/javascript
: It is the basic standard of writing javascript code inside the<script>
tag.
e.g
<script type="text/javascript">
const a = "Hello";
const b = "World!";
console.log(a + " " + b); // Hello World!
</script>
-
text/ecmascript
: this value indicates that the script is following theEcmaScript
standards. -
module
: This value tells the browser that the script is a module that can import or export other files or modules inside it. -
text/babel
: This value indicates that the script is a babel type and required bable to transpile it. -
text/typescript
: As the name suggest the script is written inTypeScript
.
-
{TitleComponent}
: This value describes theTitleComponent
as a javascript expession or a value. The{}
can embed a javascript expression or a values inside it. -
<TitleComponent/>
: This value represents a Component that is basically returning Some JSX value. in simple termsTitleComponent
a function that is returning a JSX value. A compoenet is written inside the{< />}
expression. -
<TitleComponent></TitleComponent>
:<TitleComponent />
and<TitleComponent></TitleComponent>
are equivalent only when< TitleComponent />
has no children components.The opening and closing tags are created to include the child components.
e.g.
<TitleComponent>
<ChildComponen1 />
<ChildComponen2 />
<ChildComponen3 />
</TitleComponent>