# Search UI Get State from other components?

**URL:** <https://discuss.elastic.co/t/search-ui-get-state-from-other-components/338359>\
**Category:** Elastic Search\
**Tags:** elastic-app-search\
**Created:** [July 13, 2023, 9:07pm UTC](https://discuss.elastic.co/t/search-ui-get-state-from-other-components/338359 "2023-07-13T21:07:05Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![John\_Brandenburg](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/john_brandenburg/32/117741_2.png) [@John\_Brandenburg](https://discuss.elastic.co/u/John_Brandenburg)\
**Post date:** [July 13, 2023, 9:07pm UTC](https://discuss.elastic.co/t/search-ui-get-state-from-other-components/338359/1 "2023-07-13T21:07:05Z")

</div>

How can I access the state of filters and active facets from outside of the facet components themselves? It only looks like I would need to read the URL directly myself.

---

<div class="post-metadata">

**Author:** ![nfeekery](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nfeekery/32/117349_2.png) [@nfeekery](https://discuss.elastic.co/u/nfeekery)\
**Post date:** [July 20, 2023, 1:07pm UTC](https://discuss.elastic.co/t/search-ui-get-state-from-other-components/338359/2 "2023-07-20T13:07:11Z")

</div>

My understanding of React is that you generally can't access the state of components from outside of the component itself. You could maybe use a callback function as a prop, which could pass the state of something back "up". While it isn't Search UI-specific, I've found a medium article describing how this can be achieved in general React: [link](https://medium.com/@thejasonfile/callback-functions-in-react-e822ebede766).

---

<div class="post-metadata">

**Author:** ![joemcelroy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/joemcelroy/32/103757_2.png) [@joemcelroy](https://discuss.elastic.co/u/joemcelroy)\
**Post date:** [July 20, 2023, 3:12pm UTC](https://discuss.elastic.co/t/search-ui-get-state-from-other-components/338359/3 "2023-07-20T15:12:13Z")

</div>

You should be able to using the HOC withSearch [WithSearch & withSearch | Elastic docs](https://docs.elastic.co/search-ui/api/react/with-search) to retrieve the request state

---

<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:** [August 17, 2023, 3:12pm UTC](https://discuss.elastic.co/t/search-ui-get-state-from-other-components/338359/4 "2023-08-17T15:12:44Z")

</div>

Closed on August 17, 2023, 3:12pm UTC

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