我正面临这个错误。 错误说
got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.
throw Error( "Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: " + (type == null ? type : typeof type) + "." + info );
但是,该组件被声明为导出并正确定义。
未捕获的错误:元素类型无效:需要一个字符串(对于内置组件)或一个类/函数(对于复合组件)但得到:未定义。您可能忘记从定义它的文件中导出您的组件,或者您可能混淆了默认导入和命名导入。
检查
WithContext
.的渲染方法
const ProfileUpdate = (props) => {}
const mapDispatchToProps = (dispatch) => {
return {
profileUpdate: (user) => dispatch(profileUpdate(user)),
};
};
export default connect(mapStateToProps, mapDispatchToProps)(ProfileUpdate);
完整版↓ https://www.dropbox.com/s/yubscdktmeikbqi/ProfileUpdate.js
我有同样的问题。将
react-tag-input
的版本降级为 6.4.1
帮助了我(在此之前,版本是 ^6.7.3
)。
我在 https://github.com/react-tags/react-tags/issues/573 上找到了这个解决方案