I want to access some property from the current active route outside of a component. For example, I want to read the current active route's routename inside of a saga.
I can do this by creating a ref to the container navigator and reading ref.current.state.nav. The downside is that this is the full state tree, and in order to get the specific information I want I have to recurse through the tree to parse out what I need (active route name). If I was in a component, I could do this easily with a hook. But because I'm in a side effect I'm forced to implement this myself.
I found a really lightweight 3rd party npm package that exposes this functionality. I feel like the logic to recursively extract the currently active route should be built into react-navigation.