What is Props in React JS?

As we know, the components in react js are simple javascript functions, which returns the JSX code. We can pass parameters to these component functions, which are called props.

Props stands for properties. Props are the actual parameters passed to a function. Props are available in the function as a object.

Props can be passed as a HTML attribute.

Props are read-only and we can’t change their value in the child component.

Example :

Passing the props
Using the props inside the component
Output

Leave a Reply

Your email address will not be published. Required fields are marked *