typescript - 绑定元素'children'隐式具有'any'类型
问题描述
我注意到下面的代码应该是js
编码风格,我怎么能用这种tsx
风格写?
import React, { Children } from 'react';
import { Text, StyleSheet } from 'react-native';
export function Heading ({children, props}){
return <Text{...props}>{children}</Text>
}
解决方案
试试这个代码
export function Heading ({children, props}:{children:any,props:any}){
return <Text{...props}>{children}</Text>
}
推荐阅读
- android - JobIntentService 在android Q中不起作用
- mysql - MYSQL /SQL 多别名基于列值
- r - 根据 R 中的模型参数查找预期数字
- ansible - 无法在 ansible 库存插件中使用 yaml 引用
- c# - 在 Mac 上未显示错误消息,但在 Windows 上完美运行
- python - NameError:名称“输入”未定义
- javascript - 为什么我的打字组件没有垂直对齐?
- python - Tkinter Treeview 如何用鼠标正确选择多个项目
- vb.net - 离开和返回同一表单时,Visual Studio 数据绑定出现问题
- java - 递归地在只有一个参数数组的数组中找到平均值