meabhisingh / mernProjectEcommerce

This is MERN Stack Ecommerce Project Made to Teach MERN Stack on YouTube
1.17k stars 833 forks source link

Protected Route not working #57

Closed Ahsan22812 closed 1 year ago

Ahsan22812 commented 1 year ago

Facing this error with the new react version. Any solution?

nilabhjaiswal commented 1 year ago

use npm i protected-route-react install this in your frontend after that import this npm in app.js then use this npm like this

    <Route
      exact
      path="/account"
      element={
        <ProtectedRoute>
          <Profile />
        </ProtectedRoute>
      }
    />
    <Route
      exact
      path="/me/update"
      element={
        <ProtectedRoute>
          <UpdateProfile/>
        </ProtectedRoute>
      }
    />

this will help you i asure you

Ahsan22812 commented 1 year ago

Thank youuu

nilabhjaiswal commented 1 year ago

My pleasure!

On Mon, 5 Jun 2023 at 00:28, Ahsan Ahmed @.***> wrote:

Thank youuu

— Reply to this email directly, view it on GitHub https://github.com/meabhisingh/mernProjectEcommerce/issues/57#issuecomment-1575674712, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHYGCQK5VBPAWWOQQI7PT73XJTLEXANCNFSM6AAAAAAYYGYLKY . You are receiving this because you commented.Message ID: @.***>