• react 问题记录


    1、控制台报错:

    Uncaught Error: addComponentAsRefTo(...): Only a ReactOwner can have refs. You might be adding a ref to a component that was not created inside a component's `render` method, or you have multiple copies of React loaded

    Uncaught Error: removeComponentAsRefFrom(...): Only a ReactOwner can have refs. You might be removing a ref to a component that was not created inside a component's `render` method, or you have multiple copies of React loaded

    如果检查了没有refs的错误,那么就有可能是你引入了多个react版本,我的项目使用的是yarn, yarn list react看下:

    yarn list v1.1.0
    ├─ com1@1.0.5
    │ └─ react@0.14.8
    ├─ comp2@0.0.4
    │ └─ react@0.14.8
    ├─comp3@1.0.2
    │ └─ react@0.14.8
    ├─ comp4@1.2.1
    │ └─ react@0.14.8
    ├─ comp5@1.2.0
    │ └─ react@0.14.8
    └─ react@0.14.9

    项目下面安装了react14.8 又安装了14.9

    所以会有问题

    参考https://github.com/callemall/material-ui/issues/6345

  • 相关阅读:
    我们是如何实现DevOps的
    cmp命令
    全排列II
    chown命令
    两个数组的交集II
    MVVM模式的理解
    chmod命令
    路径总和
    cat命令
    跳水板
  • 原文地址:https://www.cnblogs.com/YangqinCao/p/7685971.html
Copyright © 2020-2023  润新知