function Welcome(props) {
return <h1>Hello, {props.name}</h1>;
}
function App() {
return (
<div>
<Welcome name="Sara" />
<Welcome name="Cahal" />
<Welcome name="Edite" />
</div>
);
}
function App() {
return (
<div className="App">
<NewComponent name="Ariful Islam Adil" profession="Web-Developer"></NewComponent>
</div>
);
}
function NewComponent(props) {
return (
<div className="test-class">
<h1>Name: {props.name}</h1>
<h3>Profession: {props.profession}</h3>
</div>
)
}
export default App;
const Banner = props => {
const name = props.name
return <div>Hello {name}</div>
}
function App() {
return (
<div>
<Banner name="Ranjeet" />
</div>
)
}
export default App
function App() {
return <User name="John Doe" />
}
function User(props) {
return <h1>Hello, {props.name}</h1>; // Hello, John Doe!
}
class Checkbox extends React.Component {
constructor(props) {
super(props);
this.state = { isOn: true };
}
// ...
}
function Application() {
const userName = "John Smith";
return <UserInfo userName={userName} />;
}
function UserInfo({ userName }) {
return <span>{userName}</span>;
}
function App() {
return(
<>
<Abc/>
<Abc x="xxxxx"/>
</>
);
}
export default App;
function Abc(props)
{
return (<>{props.x?<b>ffffff</b>:<i>gggggg</i>}</>)
}
/*Abc depends on the value of the x prop*/