React Context

import {createContext, useContext, useState} from 'react';

// creates the context to store the data in
const MyContext = createContext(null);

// makes an easy provider component that encapsulates initializing the data in the context
export function CurrentBoardProvider({children}) {
  const [boardId, setBoardId] = useState(null);
  const providerValue = {boardId, setBoardId};

  return (
    <CurrentBoardContext.Provider value={providerValue}>

// custom hook that encapsulates retrieving data from the context
export function useCurrentBoard() {
  const {boardId, setBoardId} = useContext(CurrentBoardContext);
  return {boardId, setBoardId};