I am currently using React Native for the first time and I am trying to render a component in a particular screen depending on the parent stack I am in as the particular screen is reused across multiple stacks.
Right now I am doing this using the following:
props?.navigation.getState()?.routes?.[0]?.name
which is returning / having the desired effect , but I am unsure whether this is the optimal solution as I am a first time React Native user. If multiple screens are opened. Will the initial stack route always be found at props?.navigation.getState()?.routes?.[0]?.name