React Component Nesting and Reusability Explained – A Beginner's Guide 2026

Image
1. Introduction to React Component Nesting and Reusability React JS is a popular JavaScript library used to create interactive and user-friendly web applications. One of the most useful concepts in React development is component-based architecture. Instead of writing an entire website inside one large file, developers divide the user interface into smaller and manageable parts called components. Two important concepts in this approach are component nesting and component reusability. Component nesting means placing one React component inside another component to build a complete user interface. For example, a website page may contain a header, navigation bar, sidebar, content section, and footer. Each section can be developed as a separate component and combined inside a main component. Component reusability means creating a component once and using it multiple times in different parts of an application. For example, the same button, product card, or navigation menu can be reused withou...

javaScript do while loop

javaScript do while loop



        

 JavaScript  Do While loop 


what is the Javascript  do .. While loop?

1] Do while loop in JavaScript is a control flow statement that continually runs a block of code until a given condition is evaluated to false. 

2] While a do...while loop is similar to a while loop, the main distinction is that the code block is run at least once before the condition is verified.


Syntax :-

do 

{

code executed

}

while (condition)


do :-

1] keyword starts the loop.

2] block of code executed first.

while :-

1] keyword condition that is evaluated after execute of the block of code.

2] condition evaluates true  block of code executed again than condition false the loop terminates.

FlowChar :-

 Do while loop


javascript  do while loop 

1] Example

Q.  Display  Number 10 to 1 

Source code

let a=10;
do{
    console.log(a);
    a--;

}while (a>0);

Explain program :-

1] a starts at 10 .

2] loop prints value of a and decrement (a--) after each iteration 

3] condition run long i  greater than 0

 Do while loop

Display  Number 10 to 1 

Output 

Display  Number 10 to 1  javascript

JavaScript do  while loop 

2] Example

Q. display number 11 to 20 using do.. while loop


let i = 11;
do {
  console.log(i);
  i++;
} while (i <= 20);


JavaScript  do while loop 

Output :-

javascript  while loop


JavaScript  do while loop 


3] Example

Q. user input using do while loop


let input ;
do {
    input =prompt("Enter a no between 1 to 100 ");
}
while (input <1 || input > 100 );
console.log("enter your number- " +input);

JavaScript Do while loop

Output:- 

javascript do- while loop

JavaScript do while loop 

4] Example

Q. javascript that iteration 28 times 


let count =0;
do {
    console.log("count number-", count);
    count++;

}
while(count<28);

JavaScript  do while loop 

 Output:-

javascript  do while loop


Related Post :-

php program to print alphabet pattern R

php program to print half diamond pattern

javascript operators

how to create a navigation bar

Comments

Popular posts from this blog

CSS Text Color Explained with Syntax and HTML Examples

CSS Outline Offset Property with Practical Examples

Learn CSS text-decoration-color Property in Simple Words with Examples