navigate: it can be used in a variety of situations, but people learn it first as a way to push a route onto the stack, and the word seems best suited for that case. But you can do all sorts of things with navigate, such as go back (using a key)
goBack: we should distinguish between the goBack(null) and goBack() and goBack({key: 'someKey'}) cases with separate helpers with more intention revealing names.
goBack() - no key passed in, defaults to the key for the current route
goBack(key) - go back from this key to the route before it
goBack(null) - let any navigator handle this back action - if the deepest active one is already on index 0, a parent will handle
dismiss() - goBack(key) where key is the key of the navigator itself
this is all a bit confusing, in particular when you want to deal with going back across navigators
navigate
: it can be used in a variety of situations, but people learn it first as a way to push a route onto the stack, and the word seems best suited for that case. But you can do all sorts of things withnavigate
, such as go back (using akey
)goBack
: we should distinguish between thegoBack(null)
andgoBack()
andgoBack({key: 'someKey'})
cases with separate helpers with more intention revealing names.this is all a bit confusing, in particular when you want to deal with going back across navigators