• Uncaught Error: Element type is invalid: expected a string or a class/function but got: object.


    Uncaught Error: Element type is invalid: expected a string or a class/function but got: object.


    fixed:
    把DOM节点写成函数或者组件再丢进去即可.
    直接写dom常量的话就是一个对象,而我们需要的是一个可供渲染的组件
    // 如
    const Item =  <Text  content="A bug is given" />
    
    // 改成
    const Item =  () =>  <Text  content="a bug died" />
    
  • 相关阅读:
    统计字符
    两军交锋
    FatMouse' Trade
    A + B Problem II
    Number Sequence
    Max Sum
    类的设计
    类与对象
    面向对象思想
    第一个OC程序
  • 原文地址:https://www.cnblogs.com/ltfxy/p/16035370.html
Copyright © 2020-2023  润新知