这段typescript 代码有人知道啥意思吗?

#1
type Props = {
  foo: string;
};

const MyComponent: React.FunctionComponent<Props> = props => {
  return <span>{props.foo}</span>;
};

<MyComponent foo="bar" />;

来源: https://jkchao.github.io/typescript-book-chinese/jsx/reactJSX.html#html-标签

=================

问题1: <Props> 是不是定义了这个组件MyComponent 将要接受的props参数个数,以及每个参数的类型?

问题2: React.FunctionComponent 是不是组件 MyComponent的返回值类型?

谢谢

#2

问题一
用js类比
主要是把自定义的props和react预定义props组合在一起,然后返回

    function FunctionComponent(customerProps) {
      // childen 什么的
      const functionComponentDefaultProps = {};
      return {
        ...functionComponentDefaultProps,
        ...customerProps
      };
    }

问题二

React.FunctionComponent<Props>

可以看下我的练手项目也是关于ts的 求赞!!!

#3

问题一,Component里面接受的是泛型,IProps就是接口(interface)或类型(type)
问题二,是的,代表MyCompoent就是React.FunctionComponent ,相当于const a:number = 1,a就是number类型