1class Welcome extends React.Component {
2 render() {
3 return <h1>Hello, {this.props.name}</h1>;
4 }
5}
1const component = () => {
2console.log("This is a functional Component");
3}
1function Welcome(props) {
2 return <h1>Hello, {props.name}</h1>;
3}
4
5function App() {
6 return (
7 <div>
8 <Welcome name="Sara" /> <Welcome name="Cahal" /> <Welcome name="Edite" /> </div>
9 );
10}
11
12ReactDOM.render(
13 <App />,
14 document.getElementById('root')
15);
1import React from 'react'; const App = () => { const greeting = 'Hello Function Component!'; return <Headline value={greeting} />;}; const Headline = ({ value }) => <h1>{value}</h1>; export default App;