The generated id
is added to the component’s props. So it can be accessed through this.props.instanceId
inside the component.
In the example you posted it is being used to assign a unique id attribute to the html element. However it can be used for custom logic inside react. Just as an example, you can assign each component an id
and then save its data to the redux store, that way when you need to access the data from an element inside the store you can use its id
to find it.