MCPcopy Create free account
hub / github.com/krasimir/react-in-patterns / ReactElement

Function ReactElement

code/dependency-injection/public/app.js:18830–18884  ·  view source on GitHub ↗
(type, key, ref, self, source, owner, props)

Source from the content-addressed store, hash-verified

18828 * @internal
18829 */
18830var ReactElement = function (type, key, ref, self, source, owner, props) {
18831 var element = {
18832 // This tag allows us to uniquely identify this as a React Element
18833 $$typeof: REACT_ELEMENT_TYPE,
18834
18835 // Built-in properties that belong on the element
18836 type: type,
18837 key: key,
18838 ref: ref,
18839 props: props,
18840
18841 // Record the component responsible for creating this element.
18842 _owner: owner
18843 };
18844
18845 {
18846 // The validation flag is currently mutative. We put it on
18847 // an external backing store so that we can freeze the whole object.
18848 // This can be replaced with a WeakMap once they are implemented in
18849 // commonly used development environments.
18850 element._store = {};
18851
18852 // To make comparing ReactElements easier for testing purposes, we make
18853 // the validation flag non-enumerable (where possible, which should
18854 // include every environment we run tests in), so the test framework
18855 // ignores it.
18856 Object.defineProperty(element._store, 'validated', {
18857 configurable: false,
18858 enumerable: false,
18859 writable: true,
18860 value: false
18861 });
18862 // self and source are DEV only properties.
18863 Object.defineProperty(element, '_self', {
18864 configurable: false,
18865 enumerable: false,
18866 writable: false,
18867 value: self
18868 });
18869 // Two elements created in two different places should be considered
18870 // equal for testing purposes and therefore we hide it from enumeration.
18871 Object.defineProperty(element, '_source', {
18872 configurable: false,
18873 enumerable: false,
18874 writable: false,
18875 value: source
18876 });
18877 if (Object.freeze) {
18878 Object.freeze(element.props);
18879 Object.freeze(element);
18880 }
18881 }
18882
18883 return element;
18884};
18885
18886/**
18887 * Create and return a new ReactElement of the given type.

Callers 3

createElementFunction · 0.70
cloneAndReplaceKeyFunction · 0.70
cloneElementFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected