Site icon Hip-Hop Website Design and Development

Gutenberg getBlockIndex in save() function

In my block’s edit() function i’m getting the index of each inner block:

// a block used in innerblocks
edit( { attributes, setAttributes, clientId } ) {

    let blockIndex = wp.data.select( 'core/editor' ).getBlockIndex( clientId );
    
    ...

This works fine. However i tried the same in save() but I get index -1 for each block. How can I make getBlockIndex() work in save()?

I need to add index number to class names of inner blocks in HTML.