we are creating job portal on community using LWC. on community, client/vendor can create candidates, post jobs, view their candidates, jobs etc. We have created LWC for all those stuffs.

Suppose i have two LWC PageA and PageB and i want to navigate/route from PageA to PageB by passing some data/attributes on button click? these pages will be embedded on community.

It will be more helpful for me.



You can use lightning-navigation for this use case.

It has different page types you can use, based on your use case, to navigate.


  • Lightning-navigation doesn't support state property in communities. I wanted to generate LWC page url at run time on button click and redirect to that url. – akhtar Jan 1 at 11:24
  • If you just want to pass attributes, you can use localstorage, or sessionstorage from browser to do so. While navigating, storage your attributes in storage and when the component loads read those attributes and then delete them from storage. – Nagendra Singh Jan 1 at 14:25

You can use Localstorage to save the state,

Alternatively you could use: https://github.com/prashantk0001/lwc-router

However using above component will restrict you to create only one page within the community/within every page you might need to register the routes.

It supports queryparameters & pagestate.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.