'How to convert React.FC syntax to const x = () => {}?

I have this code below that I tried to convert its syntax (I am using TypeScript, React) from the syntax below to const x = () => {} form.

const EntryDetails: FC<{ entry: Entry }> = ({ entry }) => {
  switch (entry.type) {
    case 'Hospital':
      return <HospitalCard entry={entry} />;

    case 'HealthCheck':
      return <HealthCheckCard entry={entry} />;

    default:
      return assertNever(entry);
  }
};

Somehow it crashed my code so I assumed I did not convert it properly. Can someone help me get it converted?

My attempt was as below:

const EntryDetails = (entry: Entry) => {
  switch (entry.type) {
    case 'Hospital':
      return <HospitalCard entry={entry} />;

    case 'HealthCheck':
      return <HealthCheckCard entry={entry} />;

    default:
      return assertNever(entry);
  }
};

and I also tried

const EntryDetails = ({entry}: Entry) => {
  switch (entry.type) {
    case 'Hospital':
      return <HospitalCard entry={entry} />;

    case 'HealthCheck':
      return <HealthCheckCard entry={entry} />;

    default:
      return assertNever(entry);
  }
};


Solution 1:[1]

your function component must look like this...

const EntryDetail: FC<PropsFromYourTypesSheet> = (props) => {
  your Code
}

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Jonas22rr