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) {
returnHello, {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

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/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.