State Management

Managing State, Getters & Action

Pinia

Pinia is a store library for Vue, it allows you to share a state across components/pages.

If you are familiar with the Composition API, you might be thinking you can already share a global state with a simple export const state = reactive({}).

This is true for single-page applications but exposes your application to security vulnerabilities if it is server-side rendering.

State

Based on this information, we should now be able to describe the kinds of values we need to have inside our state.

const Sidebar_drawer = ref(config.Sidebar_drawer);
const Customizer_drawer = ref(config.Customizer_drawer);
const mini_sidebar = ref(config.mini_sidebar);
const setHorizontalLayout = ref(config.setHorizontalLayout);
const baseTheme = ref<string>(config.actTheme.replace('Dark', ''));
const themeMode = ref<ThemeMode>(config.themeMode);
const systemPreference = ref(false);
const fontTheme = ref(config.fontTheme);
const inputBg = ref(config.inputBg);
const boxed = ref(config.boxed);
const isRtl = ref(config.isRtl);

Writing Getters & Action

Last updated