zoukankan      html  css  js  c++  java
  • React 踩坑记录

    1.React-router error: super expression must either be null or a function

    原因:引入babel后写ES6风格的代码:

           class ComponentXX extends React.component{} 这里的C小写了,导致产生这个bug

           改为大写就可以 ,不引入router不会产生这个bug

    2.React-router 引入Link的时候,在ES6风格的代码下应该这样写:

          import {Link} from "react-router";   哪怕只有一个Link也要用花括号括起来,否则会让react报类型不正确的错误。

    3. React中需要使用 async/wait的时候需要做如下几件事

    npm install babel-preset-stage-0 --save-dev
    npm install --save-dev babel-plugin-transform-runtime
    npm install --save babel-runtime

        然后在.babelrc中进行如下配置:

    {
     "presets": [ "es2015", "stage-0","react"],
     "plugins": [
        ["transform-runtime", {
          "polyfill": false,
          "regenerator": true
        }]
      ]
    }

    如果还用到了eslint插件,还需要将.eslintrc中的规则更改一下

    {
        "no-constant-condition":[
           "warn",{
            "checkLoops":false
           }
         ],
        "no-fallthrough":["warn",{
           "commentPattern": "break[\s\w]*omitted"
        }]
    }

         

     

  • 相关阅读:
    GUC-3 模拟CAS算法
    GUC-2 原子性
    GUC-1 volatile
    NIO-5补充
    NIO-4pipe
    NIO-3网络通信(非阻塞)
    NIO-3网络通信
    NIO-1缓冲区(Buffer)
    NIO-2通道(Channel)
    eclipse安装spring boot插件spring tool suite
  • 原文地址:https://www.cnblogs.com/JhoneLee/p/5724297.html
Copyright © 2011-2022 走看看