WordPress Gutenberg react make import of __experimentalUseInnerBlocksProps which is no more experimetal

Ok, this is probably the easiest workaround I was able to find, but if someone has better idea, then feel free to post it here 😉

import {
    __experimentalUseInnerBlocksProps,
    useInnerBlocksProps,
} from '@wordpress/block-editor';

if( typeof useInnerBlocksProps == 'undefined' ){
    var compatibleUseInnerBlocksProps = __experimentalUseInnerBlocksProps;
}else{
    var compatibleUseInnerBlocksProps = useInnerBlocksProps;
}
  • so basically I can import both (experimental and no-experimental) without any error
  • then I can just do simple type test if the new one is already supported
  • if it’s supported I will remember it in compatibleUseInnerBlocksProps variable
  • otherwise I will remember old experimental
  • then I need to replace all other occurrences of useInnerBlocksProps with compatibleUseInnerBlocksProps in my code