Question on what this nested data extraction does in GroupedBarChart

Hi I found this great example:

I am still learning and I am not sure how to read the nested functions for x.

I.e. when Mike Passes x: d => d.state,
and sets x = (d, i) => i I am not quite sure how to understand it.
And later this map is applied here:
const X =, x);

I thought this should be the same as applying, (d, i) => i) but my limited javascript and d3 understanding is probably getting in the way. Since this gives an error.

How would I write this directly, or how can I understand what this nesting does?

Thanks a lot for any tips and help in advance!