Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/459.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何正确使用React.FunctionalComponent<;道具>;关于无状态功能组件?_Javascript_Flowtype - Fatal编程技术网

Javascript 如何正确使用React.FunctionalComponent<;道具>;关于无状态功能组件?

Javascript 如何正确使用React.FunctionalComponent<;道具>;关于无状态功能组件?,javascript,flowtype,Javascript,Flowtype,我需要为react无状态功能组件添加流注释。 因此,对于文档,我应该使用React.StatelessFunctionalComponent 签名如下: 键入无状态FunctionalComponent=(props:props)=> 反应节点 但我收到好几封信 我做错了什么?为什么 /@flow 从“React”导入*作为React 从“时刻”导入时刻 从“../../shared/icon/IconWeather”导入IconWeather /*eslint禁用无未定义*/ 类型Props

我需要为react无状态功能组件添加流注释。 因此,对于文档,我应该使用
React.StatelessFunctionalComponent

签名如下:

键入无状态FunctionalComponent=(props:props)=> 反应节点

但我收到好几封信

我做错了什么?为什么

/@flow
从“React”导入*作为React
从“时刻”导入时刻
从“../../shared/icon/IconWeather”导入IconWeather
/*eslint禁用无未定义*/
类型PropsType={
+日期:年月日,
+tempMin:数字,
+tempMax:数字,
+iconCode:number,
+天气描述:字符串
}
/*eslint启用无未定义*/
const ForecastDay=({date,tempMin,tempMax,iconCode,weatherDescription}:PropsType):React.statelementalFunctionalComponent=>{
const dateFormat=moment.unix(date.format('ddd,MMM D'))
const tempMinRounded=Math.round(tempMin)
const tempMaxRounded=Math.round(tempMax)
返回(
{dateFormat}
{tempMinRounded}°;
{tempMaxRounded}°;
{weatherDescription}
)
}

导出默认预报日
我通过添加

 const ForecastDay:React.StatelessComponent<PropsType>
const ForecastDay:React.statelements组件
并用作返回类型
ReactElement
React.Element

/@flow
从“React”导入*作为React
从“时刻”导入时刻
从“../../shared/icon/IconWeather”导入IconWeather
/*eslint禁用无未定义*/
类型PropsType={
+日期:年月日,
+tempMin:数字,
+tempMax:数字,
+iconCode:number,
+天气描述:字符串
}
/*eslint启用无未定义*/
const ForecastDay:React.statelement=({date,tempMin,tempMax,iconCode,weatherDescription}:PropsType):ReactElement=>{
const dateFormat=moment.unix(date.format('ddd,MMM D'))
const tempMinRounded=Math.round(tempMin)
const tempMaxRounded=Math.round(tempMax)
返回(
{dateFormat}
{tempMinRounded}°;
{tempMaxRounded}°;
{weatherDescription}
)
}

导出默认预报日
我通过添加

 const ForecastDay:React.StatelessComponent<PropsType>
const ForecastDay:React.statelements组件
并用作返回类型
ReactElement
React.Element

/@flow
从“React”导入*作为React
从“时刻”导入时刻
从“../../shared/icon/IconWeather”导入IconWeather
/*eslint禁用无未定义*/
类型PropsType={
+日期:年月日,
+tempMin:数字,
+tempMax:数字,
+iconCode:number,
+天气描述:字符串
}
/*eslint启用无未定义*/
const ForecastDay:React.statelement=({date,tempMin,tempMax,iconCode,weatherDescription}:PropsType):ReactElement=>{
const dateFormat=moment.unix(date.format('ddd,MMM D'))
const tempMinRounded=Math.round(tempMin)
const tempMaxRounded=Math.round(tempMax)
返回(
{dateFormat}
{tempMinRounded}°;
{tempMaxRounded}°;
{weatherDescription}
)
}
导出默认预报日