In v1, key
parameter is used as an identifier for the route to navigate to. If you provide the identifier (as for example in navigate({ routeName: 'someScreen', params: { someParam: 'someValue' }, key: 'someScreen' })
) and user triggers such navigation action twice (eg. by pushing a button that calls the navigation action quickly twice in a row), the navigation action will be executed only once. The second call to navigate
finds out that the route with the key is already present on the stack and instead of pushing a new instance of the same route, it calls setParams
on the existing one.
Without using the key, calling navigate({ routeName: 'someScreen' })
twice would result in pushing the route onto the stack two times.