Could you help with expanding on how to use the “local.clea()” or something similar to clear a search field on exiting a result page? The search word is stored in local (set.Item) and sent to another page with wixlocation and retrieved with (getItem). Thanks
For clearing everything:
https://www.wix.com/corvid/reference/wix-storage.Storage.html#clear
For removing a specific item:
https://www.wix.com/corvid/reference/wix-storage.Storage.html#removeItem
J.D. -Thanks and appreciate the response. I had seen those references earlier. The issue is the stored data is used to search as soon as the page loads. I want to clear the store data afterwards.
The same question was asked about a year ago and there was no clear answer. please see:
https://www.wix.com/corvid/forum/community-discussion/search-input-bar-delete-the-value-history
@freddy so retrieve the data when the search page loads, and then delete it from the storage.
@jonatandor35 Exactly! Can you please suggest the construct of the code? My knowledge is limited to learning on this forum.
@freddy on the search page:
import { local } from 'wix-storage';
let retrievedSearch = local.getItem("item");
local.removeItem("item");
//then use retrievedSearch to run the search
@jonatandor35 Thank you J.D.!
@freddy you’re welcome.