import { StateManager } from "@itwin/appui-react" ; import { createSlice , PayloadAction } from "@reduxjs/toolkit" ; example interface TestProviderState { isTraceAvailable : boolean ; } const initialState = { isTraceAvailable : false , } as TestProviderState ; export const TestProviderSliceName = "testProviderState" ; /** the TestProvider "slice" of Redux state" */ export const providerSlice = createSlice ( { name : TestProviderSliceName , initialState , reducers : { setIsTraceAvailable : ( state , action ) => { state . isTraceAvailable = action . payload ; } , } , } ) ; export const { setIsTraceAvailable } = providerSlice . actions ; /** Get the slice of the redux state that is specific to this UI provider */ export function getTestProviderState ( ) { return StateManager . store . getState ( ) . testProviderState as TestProviderState ; }