Conditional Rendering in React Complete Guide with Examples 2026

Image
  Conditional Rendering in React Conditional Rendering is one of the most useful concepts in React. It means showing different content on the screen depending on a condition. For example: If a user is logged in → show Logout If a user is not logged in → show Login If a student has passed → show Congratulations If a product is available → show Buy Now If data is loading → show Loading... React does not have a separate if rendering tag. Instead, we use normal JavaScript conditions such as if, the ternary operator, &&, and switch to decide what should appear in the UI.

html comments tag and html table tag

                                           

HTML Tag

html comments tag and html table tag


1) HTML Comments  Tag 

The comment tag is the  used to insert comments in source code. Comments are not displayed by the browser. html comments tag use comment to explain your code at the hide scripts from browsers without support for scripts.

Syntax

 The comments tag is written to the  <!-- -->   comments inserted between the start and end tags. 

Note that the exclamation mark is only used in the start tag

Program 

<! Doctype html>

<html>

<body>

<!-- This is a comment  -->

<p>This is a paragraph</p>

<!-- comments are not displayed in the browser -->

</body>

</html>  

Comments tag output

This is a paragraph

2) Multiple Lines Comments

multiple lines comments tag  the difference between tag usage wheather you commenting out one line or multiple lines html comments .  You still insert the comments between the start and end tags .you can even have the start and end tags on their own line. This make your comments line  easier to read.

Program 

<! --

This is line 1

This is line 2 

And this line 3

-->

<P>html comment tag apply </p>

 

 Multiple Lines Comments 

output

html comment tag apply

3) Tables Attributes 

( use to the Tables Attributes Border, Cellpadding , Cellspacing , height, width )

 The <table> tag is written as </table>with the various table elements nested between the start and end tags.

The HTML table tag consists of  <table> element and one or more <tr>,<th>,and<td> element. The <tr> element defines a table row , the <th> element defines a table header, and the <td>element defines a table cell. A more complex HTML table may also include <caption>, <col>, <colgroup>,<thead><tfoot> and <tbody> element. The HTML table allow web authors to arrange data link text, images , links text, images, links other tables etc. into rows and columns of cells.

Program 

<! Doctype html>

<html>

<body>

<table>

<tr>

<th>Heading 1</th>

<th>Heading 2</th>

</tr>

<tr>

<td>cell 1</td>

<td>cell 2</td>

</tr>

<tr>

<td>cell 3</td>

<td>cell 4</td>

</tr>

</table>

</body>

</html>

Tables Attributes output

Header 1 Header 2

cell 1    cell 2

cell 3     cell 4

     Related Post :-

css inline block

html form pattern

html table border

Comments

Popular posts from this blog

HTML Tag

CSS Text Color Explained with Syntax and HTML Examples

HTML Input Type Submit Syntax and Example