Programatically access widget state data?

Hello again!

I am trying to access the state data in a widget on my app. If we use the example here:

You can see that there is a refinementList widget on the brand attribute active:

What I would like to do is programatically access the state data of this widget.

For example, I would like to be able to know that “Insignia” has the most stock at 746 units, and “Samsung” is the second highest at 633.

Is this possible? The other solution I see would be to scrape my own page through jQuery or something, but this feels wrong and unnatural.

Hi Kevin,

Thanks for reaching out to Algolia!

If I understand correctly, you would like to interact with the search state. This documentation page will likely guide toward doing just that:

Since you are looking to interact with the refinementList, using connectRefinementList will allow to do this:

Let me know how it goes and if you have any further questions.
Best regards,