How do I get content from [removed] href in LWR?
In LWR, the [removed] property is not supported because of LEE's version of Locker, but in the URL I have some data that I use in the code. Is there an approach to get content from the [removed].href in another way?
Ok so I just tried and it did not work. [removed] href does not work.
Here is a workaround though. Try using CurrentPageReference from lightning/navigation
@wire(CurrentPageReference)
getpageRef(pageRef) {
console.log(pageRef.state['c__key'])
}
So if you pass this in the URL. https://******-developer-edition.ap5.force.com/testlwrpage/?c__key=123
Then it will fetch the param and give you 123.
So if you have multiple params just use it as below:
https://*******-developer-edition.ap5.force.com/testlwrpage/?c__key=123&c__key2=1234
@wire(CurrentPageReference)
getpageRef(pageRef) {
for (const key of Object.keys(pageRef.state)) {
console.log(key + " -> " + pageRef.state[key])
}
}