昨天在项目中,重新封装组件时,引用了原来的一个子组件,但发现子组件在其他页面正常,在新的组件里面就发生保存,

然后把子组件注释,随便显示其div元素也正常,纠结了很久,最后发现引用的方式有问题

子组件创建是用 export class BaseComponent extends Component {  . . .  }

新创建的组件中引用是是使用 import BaseComponent from '../components/BaseComponent', 感觉一切正常,但一直报下面的错误,最后发现引用有问题,

将引用方式调整为 import { BaseComponent } from '../components/BaseComponent' 就不报错了

创建组件后,使用 export default ComponentName;  在引用是要使用 import ComponentName from  './ComponentName';

报错提示信息如下图:

React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: undefined.的更多相关文章

  1. ReactJs 报错 Element type is invalid: expected a string (from built-in components) or a class/function (for composite components) but got: undefined. Check the render method of `Me`.

    今天在重构一个页面的时候,碰到了一个error,具体的error信息如下图中所示: 最后经过一番查找定位,终于找到了问题所在,原因就是在父组件引用子组件时多加了一个大括号. import {Chart ...

  2. React的React.createElement源码解析(一)

    一.什么是jsx  jsx是语法糖  它是js和html的组合使用  二.为什么用jsx语法 高效定义模版,编译后使用 不会带来性能问题 三.jsx语法转化为js语法  jsx语法通过babel转化为 ...

  3. TypeError: Fetch argument 0 has invalid type <type 'int'>, must be a string or Tensor. (Can not convert a int into a Tensor or Operation.)

    6月5日的時候,修改dilated_seg.py(使用tensorflow)出現了報錯: TypeError: Fetch argument 0 has invalid type <type ' ...

  4. React.createClass 、React.createElement、Component

    react里面有几个需要区别开的函数 React.createClass .React.createElement.Component 首选看一下在浏览器的下面写法: <div id=" ...

  5. org.hibernate.id.IdentifierGenerationException: Unknown integral data type for ids : java.lang.String

    org.hibernate.id.IdentifierGenerationException: Unknown integral data type for ids : java.lang.Strin ...

  6. JavaScript在IE6,IE7下报错'expected identifier, string or number'

    问题: 代码在Forefox和IE8下工作正常,但是在IE6下报错: expected identifier, string or number 假如变量options有多个选项,那么我们可以用逗号分 ...

  7. IE6,IE7,IE8下报JS错误:expected identifier, string or number的原因及解决的方法

    今天在调试一个页面的时候遇到一个问题,在IE9下执行得非常好的脚本,在IE8里打开的时候弹出错误:expected identifier, string or number,依照经验,应该是定义对象的 ...

  8. python写入文本报错TypeError: expected a string or other character buffer object

    今天用python写入文本, file_object2 = open('result.txt', 'w') file_object2.write(bookid_list) file_object2.c ...

  9. 【开发遇到的问题】Spring Mvc使用Jackson进行json转对象时,遇到的字符串转日期的异常处理(JSON parse error: Can not deserialize value of type java.util.Date from String[)

    1.问题排查 - 项目配置 springboot 2.1 maven配置jackson - 出现的场景: 服务端通过springmvc写了一个对外的接口,查询数据中的表,表中有一个字段属性是时间戳,返 ...

随机推荐

  1. Hbase设置多个hmaster

    Hbase设置多个hmaster https://www.cnblogs.com/prayer21/p/4866673.html

  2. Mybatis 系列3-结合源码解析properties节点和environments节点

    [Mybatis 系列10-结合源码解析mybatis 执行流程] [Mybatis 系列9-强大的动态sql 语句] [Mybatis 系列8-结合源码解析select.resultMap的用法] ...

  3. tensorFlow 三种启动图的用法

    tf.Session(),tf.InteractivesSession(),tf.train.Supervisor().managed_session()  用法的区别: tf.Session() 构 ...

  4. iproute2 对决 net-tools

    如今很多系统管理员依然通过组合使用诸如ifconfig.route.arp和netstat等命令行工具(统称为net-tools)来配置网络功能,解决网络故障.net-tools起源于BSD的TCP/ ...

  5. Linux查看DNS服务器及设置DNS服务器

    DNS(Domain Name System,域名系统),因特网上作为域名和IP地址相互映射的一个分布式数据库,能够使用户更方便的访问互联网,而不用去记住能够被机器直接读取的IP数串. 一台主机的dn ...

  6. ie-table不显示边框解决办法

    .thisTd {          background-clip: padding-box;           position:relative; } 原来背景也有边界的:决定背景会盖住哪些部 ...

  7. java使用jedis访问CentOS中的redis

    pom.xml <dependency> <groupId>redis.clients</groupId> <artifactId>jedis</ ...

  8. saliency map [转]

    基于Keras实现的代码文档 (图+说明) "Deep Inside Convolutional Networks: Visualising Image Classification Mod ...

  9. 10 sed命令的基本用法

    grep灵活的关联正则表达式实现文件过滤,而sed是一个数据流的编辑器,或者说是一个行编辑器,它将文件一行一行的数据放入到内存中进行编辑,而awk是一个报告生成器,这个我们以后再说: 之前我们介绍过g ...

  10. day6作业(元组,字典,集合)

    默写: 1.元组 字典 集合 列表 各自的特点 2.字典添加 删除 修改 循环 必做: 1.餐厅提供了五种不同的菜,使用元组来存储他们,并循环打印出所有菜名,要求用户输入新加的菜名,加入到菜单中,并重 ...