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...

PHP Cookies


What is a Cookie 

Cookies are frequently used to help identify users. A cookie is a little file that is embedded on the user's computer by the server. The cookie will be sent each time a browser request is made by the same machine. Cookie values may be created and retrieved using PHP.

Client-side storage is used for PHP cookies. Sessions are more secure than PHP cookies.Please try to use sessions rather than cookies as much as you can.
A PHP cookie is a little data file that is kept on the client browser. It is employed in

acknowledge the person.Cookies are stored in the client browser after being generated on the server. Three steps are involved in the cookie to user info process. The browser receives a collection of cookies from the PHP Server script, such as name, age, address, or phone number, and so forth.This data is stored by the browser locally on the computer for further use.The browser transmits the cookies the next time it makes a request to the web server. information to the server, which then utilizes it to determine 


Create Cookies with PHP

Cookie is created with the setcookie() function.

   Syntax

setcooki(name, value, expire, path, domain, secure, httponly);


1] Name :- set the name of the cookie and is stored in enviroment variable called                        HTTP_COOKIE_VARS. variable  use accessing cookies.

2] Value :- set the value name variable and content store.

3] Expiry :- future  time in second 00:00:00 GMT 7st Jul 2024

       parameter is not set cookie. cookie automatically expire web Browser is closed.

4] Path :- specifies directories which cookie a valid. single forward slash character                permits cookie be valid all direction.

5] Domain :- use to specify the domain name. all cookies only valid host and domain created 

6] Secure :- cookie should only sent secure transmission using HTTPS.  cookie sent by      regular HTTP.

Example :-


<?php
setcookie("user", "geeta");
?>
<html>
    <body>
        <?php
           if(!isset($_COOKIE["user"]))
           {
            echo "cookie not found";
           }
            else{
           echo " cookie :- ".$_COOKIE["user"];
           }
        ?>
</body>
    </html>

Output :- 






2] Retrieve a Cookie

$cookie super global variable .

Example:-

Return cookie value:-

$value=$COOKIE["cookiename"];


 3]Delete a Cookie

delete or remove cookie. expire the cookie. 

Example :-

 
<?php
setcookie("cookiename", "", time()-3600);
?>


Related Post :-


html heading tag

php program print diamond number pattern

php program using sum of digits

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