src/utils/deprecated.js
/**
 * This will log a single deprecation notice per function and forward the call
 * on to the new API.
 *
 * @param {string} namespace The namespace of the call, eg 'React'
 * @param {string} oldName The old function name, eg 'renderComponent'
 * @param {string} newName The new function name, eg 'render'
 * @param {*} ctx The context this forwarded call should run in
 * @param {function} fn The function to forward on to
 * @return {*} Will be the value as returned from `fn`
 */
This will log a single deprecation notice per function and forward the call
on to the new API.


This will log a single deprecation notice per function and forward the call on to the new API .
function deprecated(namespace, oldName, newName, ctx, fn) {
  var warned = false;
  if (__DEV__) {
    var newFn = function() {
      warning(
        warned,
        `${namespace}.${oldName} will be deprecated in a future version. ` +
        `Use ${namespace}.${newName} instead.`
      );
      warned = true;
      return fn.apply(ctx, arguments);
    };
    newFn.displayName = `${namespace}_${oldName}`;
    return assign(newFn, fn);
  }
  return fn;
}
function deprecated ( namespace , oldName , newName , ctx , fn ) { var warned = false ; if ( __DEV__ ) { var newFn = function ( ) { warning ( warned , ` ${ namespace } ${ oldName } ` + ` ${ namespace } ${ newName } ` ) ; warned = true ; return fn . apply ( ctx , arguments ) ; } ; newFn . displayName = ` ${ namespace } ${ oldName } ` ; return assign ( newFn , fn ) ; } return fn ; }
This will log a single deprecation notice per function and forward the call
 on to the new API.
This will log a single deprecation notice per function and forward the call on to the new API .
// We need to make sure all properties of the original fn are copied over. // In particular, this is needed to support PropTypes