how to get symbol(child_state) value in react-navigation 6?

Viewed 302

The logic was developed using the route.state.index value in the existing code.

After upgrading to 6, "state" went into Symbol(CHILD_STATE), but I don't know how to access it.

The value I want is an index with a numeric value of 2

enter image description here

1 Answers

React navigation provides "useNavigationState"

https://reactnavigation.org/docs/use-navigation-state/ In the above link, we see the detail about the hook.

So, I can solve to use this hook.

  const  noRenderLocation  = useNavigationState(state => state); 
  //.routes[0].state.index <-- This 'index' is that I want to contract !
Related