ymfe / qreact Goto Github PK
View Code? Open in Web Editor NEWQReact 是去哪儿网 YMFE 团队推出的 100% 兼容官方 React 的迷你框架
Home Page: https://qreact.ymfe.org/
License: Apache License 2.0
QReact 是去哪儿网 YMFE 团队推出的 100% 兼容官方 React 的迷你框架
Home Page: https://qreact.ymfe.org/
License: Apache License 2.0
当前在LICENSE文件中是Apache 2.0协议,而在package.json中是MIT协议,�不知应当如何理解
已经发布到npm的历史版本应该都是MIT协议了,后续版本会更换协议吗?
Line 45 in f786dde
此处的this.__pendingStates
可能为undefined
,因此出现类似错误:
React.js:901 Uncaught (in promise) TypeError: Cannot read property 'length' of undefined
at Object.__mergeStates (React.js:901)
at Object.mountComponent (React.js:2008)
at mountVnode (React.js:1894)
at Object.mountComponent (React.js:2015)
at mountVnode (React.js:1894)
at Object.mountComponent (React.js:2015)
at mountVnode (React.js:1894)
at mountChildren (React.js:1966)
at Object.mountElement (React.js:1946)
at mountVnode (React.js:1894)
异常出现在create-react-app + react-app-rewired中使用时,求指导。
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;
};
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();```
不是太容易形容这个问题,以下是复现的代码:
import {Component} from 'react';
import {render} from 'react-dom';
const Text = ({visible}) => {
if (visible) {
return <div>Text</div>;
}
return null;
};
class App extends Component {
state = {
showText: true
};
render() {
const {showText} = this.state;
return (
<div>
<Text visible={showText} />
<button type="button" onClick={() => this.setState({showText: !showText})}>Click</button>
</div>
);
}
}
render(
<App />,
document.body.appendChild(document.createElement('div'))
);
多次点击按钮可以看到效果:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.