Redux samples

1729
5
Jump to solution
07-22-2021 03:04 AM
henrilebon974
New Contributor III

Hello ESRI,

You provide some explainations how to create a Redux store. It is a good thing.

https://developers.arcgis.com/experience-builder/guide/widget-communication/

https://developers.arcgis.com/experience-builder/sample-code/widgets/redux/

Could you provide a sample how import it and use it in an other widget please ?

It is not clear for me.

Thanks.

 

1 Solution

Accepted Solutions
DaveFullerton
Occasional Contributor III

@henrilebon974 

I was looking at the redux sample back in March.  I figured it out by copying the simple widget and updating it to subscribe to the value that the redux widget stores.  I have attached it here.  There are comments in the code indicating everything I did to update the simple widget to turn it into the simple-redux-subscribe widget.

Hope it helps!

View solution in original post

5 Replies
DaveFullerton
Occasional Contributor III

@henrilebon974 

I was looking at the redux sample back in March.  I figured it out by copying the simple widget and updating it to subscribe to the value that the redux widget stores.  I have attached it here.  There are comments in the code indicating everything I did to update the simple widget to turn it into the simple-redux-subscribe widget.

Hope it helps!

henrilebon974
New Contributor III

Thank Dave. It is more clear for me.

0 Kudos
KarthikAditya
New Contributor III

In your attached code, there's only a single widget with a redux store. Have you managed to share this redux store with another widget to communicate between them?

If you have any code snippets that can share state between widgets using a Redux store, could you please share it here, since the guide does not have that

0 Kudos
DaveFullerton
Occasional Contributor III

The sample I attached works in tandem with Esri's Redux sample:

https://developers.arcgis.com/experience-builder/sample-code/widgets/redux/

 

BhaveshSuthar
New Contributor II

Hello @DaveFullerton !

Can you please help with how to access the state in functional component. I found in the documentation that useSelect hook can be used but don't know how to.

0 Kudos