import { createSlice , PayloadAction } from "@reduxjs/toolkit" ; export type SpectatingState = { id : string | null ; } ; const initialState = { id : null } ; const { actions , reducer : spectatingReducer , } = createSlice ( { name : "spectating" , initialState , reducers : { setSpectatingIdCommand : ( state , { payload : id } ) => ( { ... state , id } ) } } ) ; const setSpectatingIdCommand = actions . setSpectatingIdCommand ; export { setSpectatingIdCommand , spectatingReducer } ;