-
-
Notifications
You must be signed in to change notification settings - Fork 10.8k
Closed
Labels
feature-requestUsed to close PRs that haven't gone through/been accepted the Proposal process yetUsed to close PRs that haven't gone through/been accepted the Proposal process yet
Description
What is the new or updated feature that you are suggesting?
createHref need back.In some scenarios, you need to dynamically calculate the url and then use it.
Why should this feature be included?
In the previous v5 version, I can get the href in the following code.
import { useHistory } from 'react-router-dom'
const Cpt = () => {
const history = useHistory()
return <button
onClick={() => {
const href = history.createHref('/bar')
window.open(`http://some-other-domain.com${href}`)
}}
>
button
</button>
}But in the latest version, I can't achieve my needs.I just found the resolvePath method.But its result is inconsistent with createHref. And useHref cannot dynamically pass in parameters.
So, I think createHref is still necessary for its existence, or I missed something, there is a better way to achieve it in the v6 version.
Kostanos, jonkoops and jddxf
Metadata
Metadata
Assignees
Labels
feature-requestUsed to close PRs that haven't gone through/been accepted the Proposal process yetUsed to close PRs that haven't gone through/been accepted the Proposal process yet
