- Create Components folder under src folder
- Add PopsExp1.js file and add below Code
import React, { Component } from "react";
class PopsExp1 extends Component {
render() {
return (
<div>
Pops Exp1
<p>{this.props.Name}</p>
<p>{this.props.Id}</p>
</div>
);
}
}
export default PopsExp1;
- Open index.js file and update code as below
import React from "react";
import ReactDOM from "react-dom";
import PopsExp1 from "./component/PopsExp1";
import "./styles.css";
function App() {
return (
<div className="App">
<PopsExp1 Name="adi" Id="100" />
</div>
);
}
const rootElement = document.getElementById("root");
ReactDOM.render(<App />, rootElement);
No comments:
Post a Comment