How to use Routing in Venia

How to use Routing in Venia?


Routing in Venia is crucial to managing the navigation and URLs within your storefront. With routing, you can define the paths and components associated with various pages and sections of your Venia project. Here's a step-by-step guide on how to use routing in Venia:


First, you must create a "components" folder inside the src folder.

  • src > components


Then in the 2nd step, we need to create a component, "Faq", inside the components folder for our custom faq page.

  • src > components > Faq


Create file "faq.js" inside our component folder "Faq".

  • src > components > Faq > faq.js


And in the 4th step, we need to put the code snippet in the faq.js file for rendering the content in our custom faq page.

  • src > components > Faq > faq.js

import React from "react";

const Faq = () => {
   return (
               <h1>Welcome to Magento 2 Pwa Venia theme!</h1>

export default Faq;


After that, we should create an index.js file in our "Faq" component's folder.

  • src > components > Faq > index.js

export { default } from './faq';


And after that, there is a local-intercept.js file in your project's folder, and then you need to edit this file.

  • local-intercept.js

targets.of("@magento/venia-ui").routes.tap(routes => {
           name: "FaqPage",
           exact: true,
           pattern: "/faq",
           path: require.resolve("./src/components/Faq")
   return routes;


The dependency of your local-intercept.js file is already defined in the package.json file in your project folder.

  • package.json

"pwa-studio": {
   "targets": {
       "intercept": "./local-intercept.js"

Implementing routing enhances the user experience and improves the overall functionality of the Venia project.


Contact us:+91 8128405131

Email send us at hello@elightwalk.com

Pravin Prajapati
Full Stack Developer

Expert in frontend and backend development, combining creativity with sharp technical knowledge. Passionate about keeping up with industry trends, he implements cutting-edge technologies, showcasing strong problem-solving skills and attention to detail in crafting innovative solutions.

Most Visited Blog

Custom Route in Venia: Enhancing Your Storefront

Discover the potential of unique routes in Venia for a personalized retail experience. Improve Magento PWA capabilities by following our simple approach to customizing routes for maximum performance and user engagement.

Read More
Venia Step-Up: Elevate Your Storefront Experience

Venia Step-Up can take your storefront to new heights. Enhance your Magento PWA experience with features, customization possibilities, and a unified user experience. Investigate the next step in retail excellence.

Read More
How To Create an Extension In PWA studio(Venia)?

Discover the essentials of creating extensions in Venia with our guide. Enhance Magento PWA storefront by developing and implementing extensions that provide capabilities and a personalized user experience.

Read More