我看到了这个FC函数组件:
const LabelForm: FC<LabelFormProps> = ({
labels,
selectedID,
}) => {
const selectedLabel = selectedID !== undefined && labels[selectedID];通常我是这样实现的:
interface EventProps {
lang: string;
translations: Translation;
eventId: string;
}
function Event(props: EventProps) {
const { lang, translations, eventId } = props;它是一种语法糖,还是比香草糖更有优势?
发布于 2022-01-15 09:36:24
这实际上已经不是现在的优势了!CRA实际上已经回退了这个标准,因此它不再默认地在默认的npx create-react-app --typescript中发布。
这里有一个关于它的GitHub问题!
本质上,它隐含地意味着,在默认情况下总是会有子的,这是不必要的,可能会导致错误!
https://stackoverflow.com/questions/70720246
复制相似问题