jaredpalmer / react-fns

Browser API's turned into declarative React components and HoC's

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

<Location />

blakek opened this issue · comments

I'm curious if a component for location would be positively received. If so, I'd be happy to contribute a PR.

My thoughts are it would pass the following props to the component to be rendered, each coming from window.location:

  • href
  • protocol
  • host
  • hostname
  • port
  • pathname
  • search
  • hash
  • username
  • password
  • origin

Additionally, I'd like to see a query (perhaps theres a better name) prop passed to the child component that is the parsed location.search.

Concept:

/**
 * If the user navigated to https://example.com?q=cute+kittens, query would be:
 * ```
 * { q: 'cute+kittens' }
 * ```
 */
const Example = () => (
  <Location
    render={({ query }) =>
      <Search searchString={query.q} />
    }
  />
)

Yeah go for it

commented

+1

commented

Hola! So here's the deal, between open source and my day job and life and what not, I have a lot to manage, so I use a GitHub bot to automate a few things here and there. This particular GitHub bot is going to mark this as stale because it has not had recent activity for a while. It will be closed if no further activity occurs in a few days. Do not take this personally--seriously--this is a completely automated action. If this is a mistake, just make a comment, DM me, send a carrier pidgeon, or a smoke signal.

commented

Closed due to inactivity. Holler if this is a mistake, and we'll re-open it.