N
Nuxt3mo ago
Matty

Is there a way to access all useState keys in use?

I want to be able to filter all state keys. e.g.
// Access keys here???
const state_keys = ['key1', 'key2'].find((x) => x.includes('2'));

if (state_keys && state_keys.length > 0) {
for (const state_key of state_keys) {

// Do something

}
}
// Access keys here???
const state_keys = ['key1', 'key2'].find((x) => x.includes('2'));

if (state_keys && state_keys.length > 0) {
for (const state_key of state_keys) {

// Do something

}
}
1 Reply
Matty
Matty3mo ago
I think I found a solution: Object.keys(useNuxtApp().payload.state) If this isn't the best way let me know 🙂
Want results from more Discord servers?
Add your server