State Management

Managing context, state and hooks

Context API

Context provides a way to pass data through the component tree without having to pass props down manually at every level.

We are using context for login methods - Auth0, JWT, and Firebase.

State

Our application state is always kept in plain JavaScript objects and arrays which means you may not put other things into the state - no class instances, built-in JS types like Map / Set Promise / Date, functions, or anything else that is not plain JS data

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

import { CONFIG } from '../config/constant';

const initialState = {
  ...CONFIG,
  isOpen: [], //for active default menu
  isTrigger: [] //for active default menu, set blank for horizontal
};

Last updated