@mapbox/batfish
Version:
The React-powered static-site generator you didn't know you wanted
26 lines (20 loc) • 660 B
JavaScript
//
import React from 'react';
import PropTypes from 'prop-types';
export function withLocation
(
Component
) {
function WithLocation(props , context ) {
return <Component location={context.location} {...props} />;
}
WithLocation.contextTypes = {
location: PropTypes.shape({
pathname: PropTypes.string.isRequired,
hash: PropTypes.string,
search: PropTypes.string
}).isRequired
};
WithLocation.WrappedComponent = Component;
return WithLocation;
}