From 8a011282a0375df451c6d0c073c42c0af9b0ece2 Mon Sep 17 00:00:00 2001 From: Brandon Dail Date: Mon, 23 Jan 2017 18:05:59 -0600 Subject: [PATCH] Deprecate React.createMixin This API was never fully implemented. Since mixins are no longer considered part of the future React API, it will be removed. --- src/isomorphic/React.js | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/src/isomorphic/React.js b/src/isomorphic/React.js index 39b6aa31ce..5064ee63bd 100644 --- a/src/isomorphic/React.js +++ b/src/isomorphic/React.js @@ -37,20 +37,35 @@ if (__DEV__) { } var __spread = Object.assign; +var createMixin = function(mixin) { + return mixin; +}; if (__DEV__) { - var warned = false; + var warnedForSpread = false; + var warnedForCreateMixin = false; __spread = function() { warning( - warned, + warnedForSpread, 'React.__spread is deprecated and should not be used. Use ' + 'Object.assign directly or another helper function with similar ' + 'semantics. You may be seeing this warning due to your compiler. ' + 'See https://fb.me/react-spread-deprecation for more details.' ); - warned = true; + warnedForSpread = true; return Object.assign.apply(null, arguments); }; + + createMixin = function(mixin) { + warning( + warnedForCreateMixin, + 'React.createMixin is deprecated and should not be used. You ' + + 'can use your mixin directly instead.' + ); + warnedForCreateMixin = true; + return mixin; + }; + } var React = { @@ -77,10 +92,7 @@ var React = { PropTypes: ReactPropTypes, createClass: ReactClass.createClass, createFactory: createFactory, - createMixin: function(mixin) { - // Currently a noop. Will be used to validate and trace mixins. - return mixin; - }, + createMixin: createMixin, // This looks DOM specific but these are actually isomorphic helpers // since they are just generating DOM strings.