Replies: 1 comment
-
I guess above pattern is followed by many libraries. Looks bit clean as well. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm considering removing
initial
,parse
andstringify
fromuseParam
. I don't like that the behavior differs across platforms.initial
is certainly not needed, and is confusing realistically. I think the usage should instead be like this:parse
should either get removed, or should apply on both web and native equally.stringify
was only added to match react-navigation's stack, but it feels unlikely to get used.My hesitation with removing these is that I use them a lot. So I think this would be a sensible solution:
initial
tofallback
, and apply it whenever the param isundefined
. Currently, it uses a ref to track if it's the initial value, which feels hacky. It also might not work with concurrent mode (although, what will? lol). This approach also provides incorrect typesafety guarantees. If you set an initial value, then the TS types will not returnundefined
ever, even though they should.parse
on both web and native.Beta Was this translation helpful? Give feedback.
All reactions