MCPcopy Create free account
hub / github.com/Lobos/react-ui / validateMethodOverride

Function validateMethodOverride

docs/lib/react.js:4783–4795  ·  view source on GitHub ↗
(isAlreadyDefined, name)

Source from the content-addressed store, hash-verified

4781}
4782
4783function validateMethodOverride(isAlreadyDefined, name) {
4784 var specPolicy = ReactClassInterface.hasOwnProperty(name) ? ReactClassInterface[name] : null;
4785
4786 // Disallow overriding of base class methods unless explicitly allowed.
4787 if (ReactClassMixin.hasOwnProperty(name)) {
4788 !(specPolicy === SpecPolicy.OVERRIDE_BASE) ? "development" !== 'production' ? invariant(false, 'ReactClassInterface: You are attempting to override ' + '`%s` from your class specification. Ensure that your method names ' + 'do not overlap with React methods.', name) : invariant(false) : void 0;
4789 }
4790
4791 // Disallow defining methods more than once unless explicitly allowed.
4792 if (isAlreadyDefined) {
4793 !(specPolicy === SpecPolicy.DEFINE_MANY || specPolicy === SpecPolicy.DEFINE_MANY_MERGED) ? "development" !== 'production' ? invariant(false, 'ReactClassInterface: You are attempting to define ' + '`%s` on your component more than once. This conflict may be due ' + 'to a mixin.', name) : invariant(false) : void 0;
4794 }
4795}
4796
4797/**
4798 * Mixin helper which handles policy validation and reserved

Callers 1

mixSpecIntoComponentFunction · 0.85

Calls 1

invariantFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…