DEV Community

Cover image for Vue router with typescript Part 1
Guilherme Neves
Guilherme Neves

Posted on

Vue router with typescript Part 1

I've been finding a lot of people struggling with routes in vue where I work, so I decided to put together an article to clear up some doubts about routes.

Why use routes in a project?

Routes will help the user to create navigation where you can go from one page to another without needing to reload.

Like any skill, it will take some effort and practice to master Vue Router.

How do I install vue router in my project?

There are two ways to insert the vue router into a project.

  • The first way is to create the project and in the initial setup select that you want to start the project with routes.

  • The second way is in an ongoing project. To install it in the project, run the command:
    NPM
    npm install vue-router@4
    YARN
    yarn add vue-router@4

Route configuration

After installing vue router in the project, some files are created for you to configure your routes.

Image description

In this file we are going to perform most of the configurations related to routes in the project.

Let me know what you think of this short introduction to vue router in the comments and if this is something you can use in your projects. I'll be back as soon as posible for part two, where I'll delve into route settings.

Until later!

Top comments (1)

Collapse
 
donpain profile image
EdON

Tysm my friend!