1

I know how navigation.navigate and navigation.push work in react-native.

But I was wondering which is best to use under which conditions? I have been through their documentation react navigation but can't get it clearly.

Thank you!!!

Shahanshah Alam
  • 565
  • 7
  • 22

1 Answers1

1

You use navigate when you want to navigate between screens. When you are in a screen and you try to navigate to this screen again then nothing is happening because you are already there.

Using push you can add a new screen on the stack dynamically, it's useful when you want to pass unique data each time calling the same screen.

Have a look here for more details and an example https://reactnavigation.org/docs/navigating/

I hope it helps

Eleftherios
  • 186
  • 1
  • 13