This commit is contained in:
35
node_modules/react-router-dom/modules/HashRouter.js
generated
vendored
Normal file
35
node_modules/react-router-dom/modules/HashRouter.js
generated
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
import React from "react";
|
||||
import { Router } from "react-router";
|
||||
import { createHashHistory as createHistory } from "history";
|
||||
import PropTypes from "prop-types";
|
||||
import warning from "tiny-warning";
|
||||
|
||||
/**
|
||||
* The public API for a <Router> that uses window.location.hash.
|
||||
*/
|
||||
class HashRouter extends React.Component {
|
||||
history = createHistory(this.props);
|
||||
|
||||
render() {
|
||||
return <Router history={this.history} children={this.props.children} />;
|
||||
}
|
||||
}
|
||||
|
||||
if (__DEV__) {
|
||||
HashRouter.propTypes = {
|
||||
basename: PropTypes.string,
|
||||
children: PropTypes.node,
|
||||
getUserConfirmation: PropTypes.func,
|
||||
hashType: PropTypes.oneOf(["hashbang", "noslash", "slash"])
|
||||
};
|
||||
|
||||
HashRouter.prototype.componentDidMount = function() {
|
||||
warning(
|
||||
!this.props.history,
|
||||
"<HashRouter> ignores the history prop. To use a custom history, " +
|
||||
"use `import { Router }` instead of `import { HashRouter as Router }`."
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
export default HashRouter;
|
||||
Reference in New Issue
Block a user