JSFiddle - React, Tailwind, and code Playground
HTML
<script src="https://cdn.plot.ly/plotly-latest.min.js"></script><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], "type": "scatter", "mode":"markers", "ids": [0, 1, 2, 3, 4], "x": [1, 2, 3, 4, 5]}], {}, {"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])
});