🚀 LEVEL UP TO SENIOR:Unlock 500+ Advanced Practical Challenges & Expert Masterclasses.
🎓 COURSERA PARTNER:Earn professional Google, Meta, and IBM certificates to supercharge your resume.
REFERENCEreact

react Documentation

LOADING ENGINE...

React Props

Master React components, hooks, and best practices.

Props

Author

Pascual Vila

Frontend Instructor.

Props (properties) are a way to pass data from a parent component to a child component in React. Props are immutable, meaning they cannot be changed from the child component, but they can be used to dynamically render content in a component.

Passing Props:

  • From the parent component: They are passed as attributes to the child component.
  • In the child component: They are accessed through the props property.

Example of Props usage:

              {`import React from "react";
      
              function MyComponent({ name }) {
                return <h1>Hello, {name};</h1>
              }
      
              function App() {
                return <MyComponent name="John" />;
              }
      
              export default App;`}