zoukankan      html  css  js  c++  java
  • React JSX file giving error “Cannot read property 'createElement' of undefined”

    import { assert } from 'assert';
    import { MyProvider } from '../src/index';
    import { React } from 'react';
    
    const myProvider = (
      <MyProvider>
      </MyProvider>
    );
    
    describe('Array', function() {
      describe('#indexOf()', function() {
        it('should return -1 when the value is not present', function() {
          assert.equal(-1, [1,2,3].indexOf(4));
        });
      });
    });
    245
     

    To import React do import React from 'react' You add brackets when the thing you are importing is not the default export in that module or file. In case of react, it's the default export.

    This might apply to your other imports depending on how you defined them.

    import React, { Component } from 'react'
    改为
    import * as React from 'react';
    漫思
  • 相关阅读:
    JS-常用的数据结构之线性表
    Django 数据库增删改查
    Django 静态文件配置及request初识
    Django 基础
    jQuery
    前端之BOM和DOM
    前端js
    前端 css
    前端基础 html
    进度条
  • 原文地址:https://www.cnblogs.com/sexintercourse/p/15123119.html
Copyright © 2011-2022 走看看