Converting Typescript const to function

In Typescript you can create functions in multiple ways either by using the function directly or having it bound to a const. We will first give an example of a const

const MyHeader = ({myId}: MyTest) => {
    if (myId === 0) return <Header as="h1">Test</Header>;
    else {
      console.log(myId);
      return <div></div>;
    }
  }

To convert this into a function change the first line. Your const name will be the function name, the argument will be added to the function argument

function MyHeader(myId: number) {
   if (myId === 0) return <Header as="h1">Test</Header>;
   else {
     console.log(myId);
     return <div></div>;
   }
}

To call the const do like this

<MyHeader myId={id as number} />

And to call the function

{MyHeader (id as number)}