@mapbox/batfish
Version:
The React-powered static-site generator you didn't know you wanted
23 lines (19 loc) • 650 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;
}