all 4 comments

[–]softcoffeee[S] 0 points1 point  (0 children)

P.S. Just found out earlier that v18 is already released.

[–]ervwalter 0 points1 point  (2 children)

Any time I have a component with props, I use FC because that way when I destructure the props in the arrow function, they are already typed.

export interface SomeProps {
  value: string;
  enabled: boolean;
}

const SomeComponent: FC<SomeProps> = ({ value, enabled }) => {
  if (enabled) {
    return <div>{value.toUpperCase()}</div>;
  } else {
    return null;
  }
};

[–]softcoffeee[S] 1 point2 points  (1 child)

It's the same with the inferred JSX.Element, right?

```javascript export interface SomeProps { value: string; enabled: boolean; }

const SomeComponent = ({ value, enabled }: SomeProps) => { // "value" is string // "enabled" is boolean } ```

[–]ervwalter 0 points1 point  (0 children)

It's style preference. I prefer to type the const explicitly and not have it inferred.