mirror of
https://kevinblog.sytes.net/Code/Jibo-Revival-Group/RoboCommander.git
synced 2026-06-16 04:36:01 +00:00
Initial commit
This commit is contained in:
36
node_modules/react-router/es/withRouter.js
generated
vendored
Normal file
36
node_modules/react-router/es/withRouter.js
generated
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
||||
|
||||
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
|
||||
|
||||
import React from "react";
|
||||
import PropTypes from "prop-types";
|
||||
import hoistStatics from "hoist-non-react-statics";
|
||||
import Route from "./Route";
|
||||
|
||||
/**
|
||||
* A public higher-order component to access the imperative API
|
||||
*/
|
||||
var withRouter = function withRouter(Component) {
|
||||
var C = function C(props) {
|
||||
var wrappedComponentRef = props.wrappedComponentRef,
|
||||
remainingProps = _objectWithoutProperties(props, ["wrappedComponentRef"]);
|
||||
|
||||
return React.createElement(Route, {
|
||||
children: function children(routeComponentProps) {
|
||||
return React.createElement(Component, _extends({}, remainingProps, routeComponentProps, {
|
||||
ref: wrappedComponentRef
|
||||
}));
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
C.displayName = "withRouter(" + (Component.displayName || Component.name) + ")";
|
||||
C.WrappedComponent = Component;
|
||||
C.propTypes = {
|
||||
wrappedComponentRef: PropTypes.func
|
||||
};
|
||||
|
||||
return hoistStatics(C, Component);
|
||||
};
|
||||
|
||||
export default withRouter;
|
||||
Reference in New Issue
Block a user