Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature]: createHref support. #8292

Closed
hellohejinyu opened this issue Nov 9, 2021 · 2 comments
Closed

[Feature]: createHref support. #8292

hellohejinyu opened this issue Nov 9, 2021 · 2 comments
Labels

Comments

@hellohejinyu
Copy link

hellohejinyu commented Nov 9, 2021

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.

image

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.

@timdorr
Copy link
Member

timdorr commented Nov 9, 2021

Related to #8278

@brophdawg11
Copy link
Contributor

I'm going to convert this to a discussion so it can go through our new Open Development process. Please upvote the new Proposal if you'd like to see this considered!

@remix-run remix-run locked and limited conversation to collaborators Jan 9, 2023
@brophdawg11 brophdawg11 converted this issue into discussion #9842 Jan 9, 2023

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
Projects
None yet
Development

No branches or pull requests

3 participants