feat(router): add a more practical hook#106
Open
YingHuaLiu wants to merge 1 commit intoecomfe:masterfrom
Open
Conversation
Member
|
这个hook的类型设计不严谨,比如这样的: const [x, y, z] = useSearchParamsArray(['x', 'y']);
const [x, y] = useSearchParamsArray(['x', 'y', 'z']);也能通过类型验证,这导致可能在代码维护过程中,删了一个param的时候,左右不同步就会遗留问题下来 建议用tuple+重载做一下类型优化,数量超出一定范围(比如5个以上)时才转到弱限制的数组上 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When I want to get some search params, I find that useSearchParam is too complex.So I write this hook to simplify code.
e.g.
Welcome any correction.