我的反应本机打字稿项目中有以下代码片段。
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}
/>
)}
/>
}Run Code Online (Sandbox Code Playgroud)
由于 es-lint,它给出以下错误消息:
错误信息:
在父组件“DropDown”外部声明此组件或将其记忆化。如果你想允许在 props 中创建组件,请将 allowedAsProps 选项设置为 true.eslintreact/no-unstable-nested-components
错误图像:在此处输入图像描述
请问我可以知道如何修复上述错误吗?