I am writing codes for a react component with typescript. I an really curious how a generic type right beside React.FC work exactly. With or without the generic type with React.FC, the results seem pretty much the same to me.
Here are the codes.
// With a generic type //
import React, { FC } from 'react'
import { WeatherData } from '../store/types'
interface WeatherProps {
data: WeatherData
}
const Weather: FC<WeatherProps> = ({ data }) => {
return (
. . . some codes
)
}
// Without a generic type //
import React from 'react'
import { WeatherData } from '../store/types'
interface WeatherProps {
data: WeatherData
}
const Weather = ({ data }: WeatherProps) => {
return (
. . . some codes
)
}