DEV Community

KIRUBAGARAN .K
KIRUBAGARAN .K

Posted on

Props in React

In React, props (short for "properties") are used to pass information from one component to another. The main purpose of props is to allow a parent component to send data to its child components

  • Props cannot be modified by the receiving component.
  • They are strictly for reading data and should not be altered.
  • Props can be updated when the parent component’s state changes.
import React from 'react';

function lenova(props) {
    return <h1>Hello, {props.name}!</h1>;
}

function App() {
    return <Greet name="Bruce" />;
}

export default App;
Enter fullscreen mode Exit fullscreen mode

Top comments (0)