Skip to content

feat(use-url-state): 支持react router v7 #2744

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

LiryCcc
Copy link

@LiryCcc LiryCcc commented Mar 18, 2025

🤔 这个变动的性质是?

  • 其他改动(添加对react-router v7支持)

🔗 相关 Issue

💡 需求背景和解决方案

我在开发自己项目的时候使用了最新的react-router v7,版本号为7.3.0,同时用到了useUrlState这个hook,调研之后发现该hook主要使用了useNavigate useLocation这两个hook,而相比于react router v6,v7版本并未对这两个hook做出改动,可以直接复用,只需要添加peer依赖对react-router v7的支持即可。

📝 更新日志

语言 更新描述
🇺🇸 英文 Add support for react-router v7, no code changes. If react-router v7 does not modify the useLocation and useNavigate APIs in later versions, there is no risk.
🇨🇳 中文 添加对react-router v7的支持,未改动代码,若react-router v7在之后的版本未对useLocation和useNavigate的api进行修改,则无风险

☑️ 请求合并前的自查清单

⚠️ 请自检并全部勾选全部选项⚠️

  • 文档已补充或无须补充
  • 代码演示已提供或无须提供
  • TypeScript 定义已补充或无须补充
  • Changelog 已提供或无须提供

react router v7相较于react router v6,useLocation useNavigate hook未改变,故不需要修改代码,只需要修改依赖配置。
且我已在自己使用react router v7的项目中多次测试useUrlState3.5.1,未出现问题。因此添加对react router v7的支持。
@CLAassistant
Copy link

CLAassistant commented Mar 18, 2025

CLA assistant check
All committers have signed the CLA.

@li-jia-nan
Copy link
Collaborator

在这一起做了:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants