ReactTraining / react-history

Manage session history with React
267 stars 23 forks source link

Expose History component #14

Closed AsaAyers closed 8 years ago

AsaAyers commented 8 years ago

<History> is documented, but isn't exposed in import { History } from 'react-history'

AsaAyers commented 8 years ago

I'm wondering if I'm misunderstanding the documentation, or if the documentation is out of date.

I have a component where I would like to get access to the current location. It seems like I can have a <BrowserHistory> at the top of my app and I can have a <History> somewhere down the tree that would let me read the location.

I'm reading through the <History> code, and that doesn't seem to be what it's for. There is a history in the context, but propTypes isn't exposed on that import either. Unless explicitly documented I assume if importing something requires specifying a path like import propTypes from 'react-history/propTypes', then you don't consider it to be public and I shouldn't be using it.

mjackson commented 8 years ago

I think you're misunderstanding the documentation. <History> is not intended to be public API.

From the README:

Depending on the method you want to use to keep track of history, you'll import (or require) one of these methods directly from the package root (i.e. history/BrowserHistory). For the sake of brevity, the term <History> in this document refers to any of these implementations.