Skip to content

React.createElement第一个参数只能是函数或字符串  #6

Description

@chenhongen

异常出现在create-react-app + react-app-rewired中使用时,求指导。

  • config-overrides.js
module.exports = function override(config, env) {
	// do stuff with the webpack config...
	config.resolve = config.resolve || {};
        config.resolve.alias = config.resolve.alias || {};
	config.resolve.alias['react'] = 'qreact/dist/ReactIE';
	config.resolve.alias['react-dom'] = 'qreact/dist/ReactIE';
	config.resolve.alias['prop-types'] = 'qreact/lib/ReactPropTypes';
	config.resolve.alias['create-react-class'] = 'qreact/lib/createClass';

	config.resolve.alias['react-tap-event-plugin'] = 'qreact/lib/injectTapEventPlugin.js';

    return config;
};
  • index.js
require('es5-shim/es5-sham');

const React = require('react');
const ReactDOM = require('react-dom');
const App = require('./App');
//const registerServiceWorker = require('./registerServiceWorker');


ReactDOM.render(<App />, document.getElementById('root'));
//registerServiceWorker();```

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions