Jun 19, 2025
4
Level 24
Alpine.js any magic method can reset $persist to init value?
<div
x-data="{
tableColumnsVisibility: $persist([true, false, true]).as('local-storage-name'),
tableColumnsVisibilityToDefault() {
this.tableColumnsVisibility = [true, false, true];
},
}"
>
...
</div>
as you can see i need to render [true, false, true] twice, just want to know any builtin magic method can reset the variable tableColumnsVisibility to init value?
Please or to participate in this conversation.