项目作者: MikeIbberson

项目描述 :
@reach/router location HOC component
高级语言: JavaScript
项目地址: git://github.com/MikeIbberson/with-location.git
创建时间: 2019-12-09T20:58:01Z
项目社区:https://github.com/MikeIbberson/with-location

开源协议:MIT License

下载


🗺️ with-location


Status
Coverage Status


Custom Provider and HOC components for @reach/router

Available injected/inherited props

Name Descriptions Args
getFrom Get query value as string or object (will return a merged object) object or string
pushTo Add a new value to the query string any
clearByName Create a curried callback for clear-style UI elements fn => event
handleSearch Create a submit callback for handling search inputs (will delete paged queries) fn => event
getAll Returns an object of all params in play

Example

  1. import React from 'react';
  2. import { withLocation, LocationProvider } from 'with-location';
  3. const AsHoc = withLocation((props) => {
  4. // props now includes the location decorators
  5. return null;
  6. });
  7. const AsComponent = (props) => (
  8. <LocationProvider>
  9. {(utils) => {
  10. // utils now includes the location decorators
  11. return null;
  12. }}
  13. </LocationProvider>
  14. );