Context

is an externally declared state object declared via . The Provider property is a component that acts as a 'host' of the context, that is initialized with it's own value.

Children of the provider can use useContext to access the provider's current state - if no provider is found, it will return the context's initial value.

Example

import { createContext } from "kaioken"

export const ThemeContext = createContext({
  value: "light",
  toggle: () => {},
})

Related