Extracting Repeatable Fragments with Functional Components

Create a functional component that returns a fragment, allowing the reuse of fragment templates in different parts of the application.
const UserDetailsFragment = ({ user }) => (
    <p>Email: {}</p>
    <p>Age: {user.age}</p>
This component is a functional component that takes a 'user' object as props and returns a fragment containing user details. The fragment includes a heading with the user's name and paragraphs for the user's email and age.
const App = () => (
    <UserDetailsFragment user={{ name: 'John Doe', email: '', age: 30 }} />
    <UserDetailsFragment user={{ name: 'Jane Smith', email: '', age: 25 }} />
This is the 'App' component that uses the 'UserDetailsFragment' functional component to render user details for two different users. It shows how the fragment can be reused with different user data.