【发布时间】:2022-08-04 01:44:38
【问题描述】:
我的 react-native typescript 项目中有以下代码 sn-p。
import React from \'react\';
import { View, Text } from \'react-native\';
import DropDownPicker from \'react-native-dropdown-picker\';
const Dropdown = () =>{
<DropDownPicker
ArrowDownIconComponent={() => ( // this is the section I getting the error message
<MaterialCommunityIcons
name=\"home-outline\"
size={50}
color={theme.colors.text}
/>
)}
/>
}
由于 es-lint,它给出了以下错误消息:
错误信息:
在父组件 \"DropDown\" 之外声明这个组件或 memoize 它。如果要允许在 props 中创建组件,请设置 allowAsProps true.eslintreact/no-unstable-nested-components 的选项
错误图片:enter image description here
请问我可以知道如何解决上述错误吗?
标签: react-native typescript-eslint