In a class-based React component, you can use props by accessing them via this.props. Here's a simple example:
import React, { Component } from "react";
class Greeting extends Component {
render() {
return <h1>Hello, {this.props.name}!</h1>;
}
}
export default Greeting;
<Greeting name="Nidhi" />