Skip to content

MusiurAlamOpu/hoc-private-route-next-js

Repository files navigation

hoc-private-route-next-js Assalamo alaikum....

Here I gonna show you how to use HOC(Higher Order Component) to make a private route in Next JS.

But you can use this also in React.

What I have done?

  1. I used a js file where I have written some functions which will help us to get, set, delete, delete all the cookies in browser cookies.

  2. I made a HOC function to authenticate any component which will be in the private route.

  3. A home page with a basic design, we will see. From there We can go to the dashboard if the user signed in.

  4. A navbar will be used to navigate the Dashboard page, homepage, login page, or logout.

Here is the repository link: https://github.com/MusiurAlamOpu/hoc-private-route-next-js

Demo Site link: https://hoc-private-route-next-js.vercel.app/

If you want to know further or facing any problem regarding implementation...let me know via my email musiuralamo@gmail.com

Zajakallahu khayer.

Releases

No releases published

Packages

No packages published