Skip to content

Commit

Permalink
React New Reconciler
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
sebmarkbage committed May 3, 2016
1 parent 2c4dbc2 commit a81b218
Show file tree
Hide file tree
Showing 23 changed files with 107 additions and 0 deletions.
40 changes: 40 additions & 0 deletions src/renderers/noop/ReactNoop.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/**
* Copyright 2013-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 ReactNoop
* @flow
*/

/**
* This is a renderer of React that doesn't have a render target output.
* It is useful to demonstrate the internals of the reconciler in isolation
* and for testing semantics of reconciliation separate from the host
* environment.
*/

'use strict';

var ReactNewReconciler = require('ReactNewReconciler');

var NoopRenderer = ReactNewReconciler({

createHostInstance() {

}

});

var ReactNoop = {

render(element : ReactElement) {

}

};

module.exports = ReactNoop;
29 changes: 29 additions & 0 deletions src/renderers/shared/reconciler/new/ReactFiber.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/**
* Copyright 2013-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 ReactFiber
* @flow
*/

'use strict';

type EffectTag = number;

export type Fiber = {

handlerTag: EffectTag

};

module.exports = function() : Fiber {
return {

handlerTag: 0

};
}
38 changes: 38 additions & 0 deletions src/renderers/shared/reconciler/new/ReactNewReconciler.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/**
* Copyright 2013-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 ReactNewReconciler
* @flow
*/

'use strict';

type ReactHostElement<T, P> = {
type: T,
props: P
};

export type HostConfig<T, P, I> = {

createHostInstance(element : ReactHostElement) : I

};

export type Reconciler = {
mountNewRoot(element : ReactElement) : void;
};

module.exports = function<T, P, I>(config : HostConfig<T, P, I>) : Reconciler {
return {

mountNewRoot() {

}

};
}
File renamed without changes.

0 comments on commit a81b218

Please sign in to comment.