Skip to content

Instantly share code, notes, and snippets.

@D-Maher
Last active March 16, 2023 23:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save D-Maher/ee0fc65d44b355b9ee7bdd566bd6012e to your computer and use it in GitHub Desktop.
Save D-Maher/ee0fc65d44b355b9ee7bdd566bd6012e to your computer and use it in GitHub Desktop.
React component with props
import React from "react";
function UserGreeting({ name, age }) {
return (
<p>
Hello, my name is {name} and I am {age} years old.
</p>
);
}
function App() {
return (
<div>
<UserGreeting name="John" age={30} />
<UserGreeting name="Jane" age={25} />
</div>
);
}
export default App;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment