I’m trying using an object in a page then continue editing it on another page ! i tried to put it on public/vars.js but it didn’t work.
Hi Raghd,
Every page is loaded “fresh”, without any memory of the previous page, just like a regular website.
In order to pass objects between pages, you have two ways:
-
Use local storage:wix-storage-frontend - Velo API Reference - Wix.com
-
Use query parameters:
On the first page, navigate to the other page and pass query parameters through code:
import wixLocation from 'wix-location';
export function button1_click(event, $w) {
wixLocation.to('/another-page?data=some-data');
}
On the other page, you can use the data by getting the query (here I just print it to the console):
import wixLocation from 'wix-location';
$w.onReady(function () {
console.log(wixLocation.query)
});