Everybody's using React Navigator probably for a reason.
My question is do I have to use it?
Can't I navigate between screens by just showing and hiding components?
CodePudding user response:
Ofcourse you can hide and show React elements to give navigation effect but how long can you keep hiding and showing elements. Also by doing this you'll create your own navigation pattern.
Better to use standard Navigation patterns which handles navigation stack, back button handlers and navigation animations for you.
React Navigation is not only option for navigation. There's one by Wix and other by React Router
CodePudding user response:
Sure, and if your app is relatively simple, React Navigation might be overkill. React Navigation is nice if:
- you have a bunch of screens
- you want to keep track of navigation history
- you want implicit or explicit control over navigation animations
- you want to pass params to screens without directly passing props
- you want to hire people familiar with its patterns
- you like the hooks and utils it gives you (focus effects, etc)
These are why my team uses it. It doesn't come for free; there are idiosyncrasies, Typescript tweaks and hacks, and general time spent fighting with it. For the average production app it's probably worth it.