JSFiddle - React, Tailwind, and code Playground
HTML
<head><meta charset="utf-8" /><script src="https://cdn.plot.ly/plotly-latest.min.js"></script></head><div id="myPlotDiv" style="height: 100%; width: 100%;" class="plotly-graph-div"></div><script type="text/javascript">window.PLOTLYENV=window.PLOTLYENV || {};window.PLOTLYENV.BASE_URL="https://plot.ly";Plotly.newPlot("myPlotDiv", [{"y": [1046.67, 1315.0, 1418.0, 997.33, 2972.3, 9700.0, 6726.0, 6002.5, 2096.0, 2470.0, 867.0, 2201.7, 1685.6, 2416.7, 1618.3, 2410.0, 2962.0], "type": "box", "ids": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16], "x": [1, 3, 3, 1, 2, 2, 2, 2, 3, 3, 1, 3, 3, 3, 3, 2, 3]}], {}, {"showLink": false, "linkText": "Export to plot.ly"})</script>
JavaScript
var plotly_div = document.getElementById('myPlotDiv')
var plotly_data = plotly_div.data
plotly_div.on('plotly_click', function(data){
console.log('Feature IDS = ', featureId = plotly_data[0].ids[data.points[0].pointNumber])
});