There is a problem in the gutenberg block I developed. Problem withInstanceId

I can get a unique id withInstanceId , but I get a bug like this on my block in dev console.

Expected:
<div id=”deneme-carousel-1″ class=”owl-carousel owl-theme”></div><script>jQuery( document ).ready( function() { jQuery(‘#deneme-carousel-1’).owlCarousel();</script>
Actual:
<div id=”deneme-carousel-21″ class=”owl-carousel owl-theme”></div><script>jQuery( document ).ready( function() { jQuery(‘#deneme-carousel-21’).owlCarousel();</script>

index.js
save: withInstanceId( function( { instanceId} ) {
return(
<div id={`deneme-carousel-${ instanceId }`} className={ classnames( ‘owl-carousel’, ‘owl-theme’, className ) }>
</div>
<script>
{‘function() { jQuery(‘#’+`deneme-carousel-${instanceId}`+”).owlCarousel();’}
</script>
} ),

Read more here:: There is a problem in the gutenberg block I developed. Problem withInstanceId

Leave a Reply

Your email address will not be published. Required fields are marked *