React – Components and props

Components :

In react , components is a reusable and independent piece of UI .
Think of its like a function or building block that return html with javascript logic.
Components make your code modular , reusable and easy to maintain.
Types of componen…


This content originally appeared on DEV Community and was authored by Dharshini E

Components :

  • In react , components is a reusable and independent piece of UI .
  • Think of its like a function or building block that return html with javascript logic.
  • Components make your code modular , reusable and easy to maintain.
    Types of components :

  • functional components

  • class components
    Example:
    function Welcome(props) {
    return

    Hello, {props.name}!

    ; }

function App() {
return (






);
}

Props:

  • props stands for properties.
  • they are like function parameters in javascript
  • props are used to pass data from parent componts to child component.
  • props are read-only .child can not modify them. Example: function Child(props) { return

    My favorite color is {props.color}

    ; }

function Parent() {
return ;
}


This content originally appeared on DEV Community and was authored by Dharshini E


Print Share Comment Cite Upload Translate Updates
APA

Dharshini E | Sciencx (2025-09-19T04:27:48+00:00) React – Components and props. Retrieved from https://www.scien.cx/2025/09/19/react-components-and-props/

MLA
" » React – Components and props." Dharshini E | Sciencx - Friday September 19, 2025, https://www.scien.cx/2025/09/19/react-components-and-props/
HARVARD
Dharshini E | Sciencx Friday September 19, 2025 » React – Components and props., viewed ,<https://www.scien.cx/2025/09/19/react-components-and-props/>
VANCOUVER
Dharshini E | Sciencx - » React – Components and props. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2025/09/19/react-components-and-props/
CHICAGO
" » React – Components and props." Dharshini E | Sciencx - Accessed . https://www.scien.cx/2025/09/19/react-components-and-props/
IEEE
" » React – Components and props." Dharshini E | Sciencx [Online]. Available: https://www.scien.cx/2025/09/19/react-components-and-props/. [Accessed: ]
rf:citation
» React – Components and props | Dharshini E | Sciencx | https://www.scien.cx/2025/09/19/react-components-and-props/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.