mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
This is an outline for the new reconciler infrastructure.
I created a noop renderer to have something to get started from.
I split the reconciler folder into old and new, as well as shared.
I put shouldUpdateReactComponent in shared as an example of a
utility that can easily be shared between both. I plan on breaking
out more utilities like these.
(cherry picked from commit cf157886e9)
48 lines
1.2 KiB
JavaScript
48 lines
1.2 KiB
JavaScript
/**
|
|
* Copyright 2014-present, Facebook, Inc.
|
|
* All rights reserved.
|
|
*
|
|
* This source code is licensed under the BSD-style license found in the
|
|
* LICENSE file in the root directory of this source tree. An additional grant
|
|
* of patent rights can be found in the PATENTS file in the same directory.
|
|
*
|
|
* @providesModule ReactSimpleEmptyComponent
|
|
*/
|
|
|
|
'use strict';
|
|
|
|
var ReactReconciler = require('ReactReconciler');
|
|
|
|
|
|
var ReactSimpleEmptyComponent = function(placeholderElement, instantiate) {
|
|
this._currentElement = null;
|
|
this._renderedComponent = instantiate(placeholderElement);
|
|
};
|
|
Object.assign(ReactSimpleEmptyComponent.prototype, {
|
|
mountComponent: function(
|
|
transaction,
|
|
nativeParent,
|
|
nativeContainerInfo,
|
|
context
|
|
) {
|
|
return ReactReconciler.mountComponent(
|
|
this._renderedComponent,
|
|
transaction,
|
|
nativeParent,
|
|
nativeContainerInfo,
|
|
context
|
|
);
|
|
},
|
|
receiveComponent: function() {
|
|
},
|
|
getNativeNode: function() {
|
|
return ReactReconciler.getNativeNode(this._renderedComponent);
|
|
},
|
|
unmountComponent: function() {
|
|
ReactReconciler.unmountComponent(this._renderedComponent);
|
|
this._renderedComponent = null;
|
|
},
|
|
});
|
|
|
|
module.exports = ReactSimpleEmptyComponent;
|