Created
June 28, 2018 12:48
-
-
Save michalklim/bd8d0712ffa7c200e2d172e493fa27e0 to your computer and use it in GitHub Desktop.
React Router shapes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import PropTypes from 'prop-types' | |
export const locationShape = PropTypes.shape({ | |
pathname: PropTypes.string.isRequired, | |
search: PropTypes.string.isRequired, | |
hash: PropTypes.string.isRequired, | |
state: PropTypes.object, | |
}); | |
export const historyShape = PropTypes.shape({ | |
action: PropTypes.string.isRequired, | |
block: PropTypes.func.isRequired, | |
createHref: PropTypes.func.isRequired, | |
go: PropTypes.func.isRequired, | |
goBack: PropTypes.func.isRequired, | |
goForward: PropTypes.func.isRequired, | |
listen: PropTypes.func.isRequired, | |
length: PropTypes.number.isRequired, | |
push: PropTypes.func.isRequired, | |
replace: PropTypes.func.isRequired, | |
location: locationShape.isRequired, | |
}); | |
export const matchShape = PropTypes.shape({ | |
isExact: PropTypes.bool.isRequired, | |
path: PropTypes.string.isRequired, | |
url: PropTypes.string.isRequired, | |
params: PropTypes.object, | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment