Changes in the router and state management
The new approach to components and modularity also affects the router and the state management. While a new version of the router has been provided for Vue 3, the state management’s official solution has moved away from Vuex to Pinia. More information about the new router and Pinia can be found in Chapter 5, Single-Page Applications, and in Chapter 7, Data Flow Management, respectively.
The new router now has a different approach to defining modes, using constructors such as createWebHashHistory
(hash mode), createWebHistory
(history mode), and createMemoryHistory
(navigation in memory alone). This change also affected the configuration of the production bundle. In WebPack, when in history mode, the deployment path was part of the bundler configuration. Now, the path is passed to the constructor as a parameter, being handled completely by the router.