Loading...

How to use Routing in Venia?

Pravin Prajapati  ·   21 Dec 2022
How to use Routing in Venia
service-banner

Introduction

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:

Step-1

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

  • src > components

Step-2

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

  • src > components > Faq

Step-3

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

  • src > components > Faq > faq.js

Step-4

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
js

import React from "react";

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

export default Faq;