'Accesing SVG layers with React

I am doing a school project in which I have a floor layout svg that has each room in it's separate layer. I would like to assign an onclick function with some input data on each of these using map. I can't seem to figurate out how to do it though. I was told this is possible and from a game called Rival Regions which uses a clickable SVG map with each path having it's own data it seems possible but I just can't find any mentions on how to do it. Example in Rival Regions. Example of how each path (or at least it seems it's the path doing it) is clickable and has it's own data about the state, region etc.

How to map the svg, how to feed it data / onclick handle. Anything that could help me or guide me in the right direction is appreciated!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source