createStateContainerReactHelpers
factory allows you to easily use state containers with React.
import { createStateContainer, createStateContainerReactHelpers } from 'src/plugins/opensearch_dashboards_utils';
const container = createStateContainer({});
export const {
Provider,
Consumer,
context,
useContainer,
useState,
useTransitions,
useSelector,
connect,
} = createStateContainerReactHelpers<typeof container>();
Wrap your app with <Provider>
.
<Provider value={container}>
<MyApplication />
</Provider>