I'm working on a relatively simple Aura component, but I'm running into an issue. I'd like to create either a cookie or a
localStorage item for a component when a user takes action on it (closes it) so that the instance of the component 'remembers' if it should be closed when the page is reloaded. Otherwise, the component will simply reappear when the page reloads.
The issue is that I'm unsure if there is a way to either find or assign a globally unique identifier for an instance of a component. There could be multiple instances of this same component on a page, and it can be used on any flexipage, so something like a record Id wouldn't be applicable.
I've tried setting a randomly generated ID attribute on
init, but I've not determined a way for this id to persist on the component. Whenever it loads, that ID simply gets regenerated.
TL;DR I need a way to find or assign a globally unique identifier to each instance of a component that is persistent, if one even exists