# Using distinct state containers (global/local) for the same component

**URL:** <https://discuss.elastic.co/t/using-distinct-state-containers-global-local-for-the-same-component/303045>\
**Category:** Kibana\
**Tags:** kibana-plugin-development\
**Created:** [April 22, 2022, 2:38pm UTC](https://discuss.elastic.co/t/using-distinct-state-containers-global-local-for-the-same-component/303045 "2022-04-22T14:38:27Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Specialist](https://avatars.discourse-cdn.com/v4/letter/s/e480ec/32.png) [@Specialist](https://discuss.elastic.co/u/Specialist)\
**Post date:** [April 22, 2022, 2:38pm UTC](https://discuss.elastic.co/t/using-distinct-state-containers-global-local-for-the-same-component/303045/1 "2022-04-22T14:38:27Z")

</div>

Hi there,

let's say I have a custom Kibana plugin that should access global (`_g`) as well as application-specific state. To do so, have have created two state containers via `createStateContainer` from `create_state_container.ts`.

I'd like to use `connect` from `create_state_container_react_helpers.ts` to map the state to a React component's props, but I can't seem to figure out how to merge app-specific and global state (connect only seems to support a single state container).

Any hints how to achieve this are much appreciated!

---

<div class="post-metadata">

**Author:** ![rashmi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rashmi/32/16391_2.png) [@rashmi](https://discuss.elastic.co/u/rashmi)\
**Post date:** [April 25, 2022, 11:28pm UTC](https://discuss.elastic.co/t/using-distinct-state-containers-global-local-for-the-same-component/303045/2 "2022-04-25T23:28:50Z")

</div>

First off, I would start off by providing you the link to the plugin development documentation .

> **[External plugin development | Kibana Guide \[8.1\] | Elastic](https://www.elastic.co/guide/en/kibana/current/external-plugin-development.html)**
>
> Conceptual and step-by-step procedures for using runtime fields, scripted fields, and field formatters.

Am copying few experts here who may take a look at your question and provide inputs when feasible .  
cc @spalger@lukeelmers

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [May 23, 2022, 11:29pm UTC](https://discuss.elastic.co/t/using-distinct-state-containers-global-local-for-the-same-component/303045/3 "2022-05-23T23:29:37Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
