React-Native Navigation Experimental on NavigationStateUtils.js,
What is the purpose of Using a Slice over here, as it returns same exact array of routes even though slice() is not used.
Or it is Just there to be consistent with pop.
The purpose is probably to create a copy of the
state.routes array before modifying it, so as not to mutate the original array referenced by
state.routes. Keeping your data structures immutable (by making a copy that you modify, rather than modifying the original) can help to avoid unexpected bugs when an array/object/etc. is modified by some other part of the code. It's a commonly used principle in Functional programming, a paradigm which React generally adheres to.