Re: [css-houdini-drafts] Pure/idempotent representation

_From @appsforartists on September 28, 2016 16:48_

It looks like [they check](https://github.com/facebook/react/blob/f3569a2c311808d4d6d2b9dcf7ec6df064bce76e/src/renderers/shared/stack/reconciler/ReactCompositeComponent.js#L210) for a `render` method and a sentinel (`isReactComponent`) that [is set](https://github.com/facebook/react/blob/d1256825bcab63f16d9335a2841558379e7cbddd/src/isomorphic/modern/class/ReactComponent.js#L33) on the base class.

There is indeed a pre-ES2015 way to declare a component, [`React.createClass(dict)`](https://facebook.github.io/react/docs/reusable-components.html).  It appears they [generate a class dynamically](https://github.com/facebook/react/blob/334b8bdf165c47336b467a4092e3f51893a83c0d/src/isomorphic/classic/class/ReactClass.js#L810) that descends from `ReactComponent`, thus inheriting the sentinel and being easily distinguished from a pure function.

@vjeux, @gaearon, and @sebmarkbage understand the React internals better than I do.


-- 
GitHub Notification of comment by majido
Please view or discuss this issue at https://github.com/w3c/css-houdini-drafts/issues/809#issuecomment-417053625 using your GitHub account

Received on Wednesday, 29 August 2018 18:18:47 UTC