nandorojo / solito

🧍‍♂️ React Native + Next.js, unified.
https://solito.dev
MIT License
3.54k stars 181 forks source link

useParam initial value doesn't work on native #172

Closed louisholley closed 2 years ago

louisholley commented 2 years ago

hey

doing const [thing, setThing] = useParam('myParam', { initial: 'whatever' }) doesn't seem to work on native - thing is always undefined if not explicitly passed. am i missing something or will we need to build a workaround for this?

nandorojo commented 2 years ago

Yeah this field only applies on Web, since the user might override the field in the URL bar. You can instead do [thing = ‘whatever’] if you want. In hindsight I think my API could be better.

louisholley commented 2 years ago

nice - we may be using the field incorrectly in that case. that's a good shout though, thanks @nandorojo