MCPcopy Index your code
hub / github.com/microsoft/SandDance / ReactElement

Function ReactElement

docs/external/js/react.development.js:755–807  ·  view source on GitHub ↗
(type, key, ref, self, source, owner, props)

Source from the content-addressed store, hash-verified

753
754
755 var ReactElement = function (type, key, ref, self, source, owner, props) {
756 var element = {
757 // This tag allows us to uniquely identify this as a React Element
758 $$typeof: REACT_ELEMENT_TYPE,
759 // Built-in properties that belong on the element
760 type: type,
761 key: key,
762 ref: ref,
763 props: props,
764 // Record the component responsible for creating this element.
765 _owner: owner
766 };
767
768 {
769 // The validation flag is currently mutative. We put it on
770 // an external backing store so that we can freeze the whole object.
771 // This can be replaced with a WeakMap once they are implemented in
772 // commonly used development environments.
773 element._store = {}; // To make comparing ReactElements easier for testing purposes, we make
774 // the validation flag non-enumerable (where possible, which should
775 // include every environment we run tests in), so the test framework
776 // ignores it.
777
778 Object.defineProperty(element._store, 'validated', {
779 configurable: false,
780 enumerable: false,
781 writable: true,
782 value: false
783 }); // self and source are DEV only properties.
784
785 Object.defineProperty(element, '_self', {
786 configurable: false,
787 enumerable: false,
788 writable: false,
789 value: self
790 }); // Two elements created in two different places should be considered
791 // equal for testing purposes and therefore we hide it from enumeration.
792
793 Object.defineProperty(element, '_source', {
794 configurable: false,
795 enumerable: false,
796 writable: false,
797 value: source
798 });
799
800 if (Object.freeze) {
801 Object.freeze(element.props);
802 Object.freeze(element);
803 }
804 }
805
806 return element;
807 };
808 /**
809 * Create and return a new ReactElement of the given type.
810 * See https://reactjs.org/docs/react-api.html#createelement

Callers 3

createElementFunction · 0.85
cloneAndReplaceKeyFunction · 0.85
cloneElementFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected