To create a very basic example of a function component in react that is within the same file, you can use this example:

  function Car(props:any) {
    return <h2>Hi, the car name is {props.name}</h2>;
  }

JSX Code:

<Car name="Honda Civic"/>

Hope that works!