是否可以在不使用箭头功能的情况下使用TypeScript键入React函数组件?

时间:2019-03-12 00:36:38

标签: reactjs typescript

目前,我有这样的React组件:

import React, { FunctionComponent } from "react";

const HelloWorld : FunctionComponent = () => {
  return (
    <div>
      Hello
    </div>
  );
}

export default HelloWorld;

我不想这样使用箭头功能并编写我的组件:

import React, { FunctionComponent } from "react";

function HelloWorld() {
  return (
    <div>
      Hello
    </div>
  );
}

export default HelloWorld;

是否可以将普通函数键入为FunctionComponent

0 个答案:

没有答案
相关问题