mirror of
https://github.com/facebookarchive/prepack.git
synced 2024-10-27 07:41:52 +03:00
cd30805c65
Summary: Release notes: none This PR adds some sanity around React components roots that when render, mutate the same of bindings as other React component roots. This is currently not supported and thus safely bails out and continues. Closes https://github.com/facebook/prepack/pull/1736 Differential Revision: D7600373 Pulled By: trueadm fbshipit-source-id: fe2b2b3055fa3c1b28668da6d67bca3826431eb6
33 lines
627 B
JavaScript
33 lines
627 B
JavaScript
var React = require('react');
|
|
// the JSX transform converts to React, so we need to add it back in
|
|
this['React'] = React;
|
|
|
|
let lazyVariable = null;
|
|
|
|
function A(props) {
|
|
if (!lazyVariable) {
|
|
lazyVariable = props.x;
|
|
}
|
|
return <div>Hello {lazyVariable}</div>;
|
|
}
|
|
|
|
function App(props) {
|
|
return (
|
|
<div>
|
|
<A {...props} />
|
|
<A {...props} />
|
|
<A {...props} />
|
|
</div>
|
|
);
|
|
}
|
|
|
|
App.getTrials = function(renderer, Root) {
|
|
renderer.update(<Root />);
|
|
return [['simple render', renderer.toJSON()]];
|
|
};
|
|
|
|
if (this.__optimizeReactComponentTree) {
|
|
__optimizeReactComponentTree(App);
|
|
}
|
|
|
|
module.exports = App; |