You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Dec 3, 2022. It is now read-only.
By default, fail fast if navigation is not found in context #37
We'd rather fail fast if context is not found and user use useNavigation(), with an option to allow useNavigation to return undefined, to support more advanced usecases (see the PR)
Honestly I'd find it more easy to handle with useNavigation({optional: true}) or something, would require less boilerplate for people wanting to use this (I do), and we can create TS overloaded functions to return navigation | undefined
idk, it seems to be a very specific use case. I'd rather export NavigationContext for advanced cases so users can access it with useContext(NavigationContext) if they don't want an error thrown for incorrect usage.
Activity
satya164 commentedon Aug 26, 2019
We're throwing an error in navigation ex. I think it's more confusing for the user to give undefined instead of a proper error.
satya164 commentedon Aug 26, 2019
The lint rule won't allow it, but I wonder what's wrong with having it in try catch. The order if hooks should still hold true
slorber commentedon Aug 28, 2019
Honestly I'd find it more easy to handle with
useNavigation({optional: true})or something, would require less boilerplate for people wanting to use this (I do), and we can create TS overloaded functions to return navigation | undefinedsatya164 commentedon Aug 28, 2019
idk, it seems to be a very specific use case. I'd rather export
NavigationContextfor advanced cases so users can access it withuseContext(NavigationContext)if they don't want an error thrown for incorrect usage.slorber commentedon Aug 28, 2019
Yes that would do the job too :) don't know why I didn't think of that 👍
slorber commentedon Aug 29, 2019
Will be fixed by #38, going to merge/release soon
slorber commentedon Aug 31, 2019
should be fixed by release 1.0.3 and #38, please tell me if everything works