I guess this is expected behavior. If I add a similar console.log to native core blocks that use useState, I get the same effect. It seems that WordPress operates with use strict, and according to this answer, React double-invokes a number of things when in strict mode.
Related Posts:
- lodash dependency in a Gutenberg plugin
- creating elements/innerblocks via rangecontrol
- Looking for callback function after Gutenberg is rendered?
- Gutenberg: useDispatch is not a function – @wordpress/data included
- Make a list with header and subtext in Gutenberg blocks
- Gutenberg – What is the best way to save/update post meta?
- How to prevent UNDO on guternberg block editor
- Creating a custom Gutenberg block with columns
- Gutenberg: import dependency or assign from global variable?
- How to control an elements classes from multiple Gutenberg sidebar controls?
- Developing the save function in Gutenberg blocks
- Gutenberg – is it ok to load dependencies multiple times?
- Preventing double loading JS scripts (like React) when developing for Gutenberg
- Getting incorrect filepath inside custom block front-end output using @wordpress/create-block tutorial
- Trigger function on Remove block or add new block in Gutenberg JavaScript
- Rerender core Templates with with ToggleControl but it doesnt recognize block type
- HTMLCollection not counting right in editor? / for loop not working on elements in DOM
- What happens/fires when you select a block in the editor?
- Is “document loaded” different on admin side than public side?
- How to use setAttributes outside of the edit function return
- why is apiFetch throwing Unhandled Promise Rejection: TypeError: Object is not a function
- Reading plugin settings in esnext wordpress block
- How can i add insertion point between inner blocks in my custom block like core blocks
- Reinitiate Gutenburg’s blocks using javascript
- Insert text programmatically in WordPress Gutenberg Editor
- Javascript function defined in view.js not reachable from save.js
- How to move custom gutenberg block controls from settings to styles tab?
- How to use useSelect to retrieve the currently default fontFamily?
- Event when Modal is opened/visible
- useBlockProps() nests wrapper with class name inside block wrapper in the editor
- Is It Possible to Use the Block Editor’s Notification Feature to Send Another Notification After the Post Is Saved?
- Is it possible to reuse wp.media.editor Modal for dialogs other than media
- How to provide translations for a WordPress TinyMCE plugin?
- How-to implement admin Ajax inside an admin WP_List_Table?
- How to remove unwanted panels inside InspectorControls from core blocks in Gutenberg
- Create Element From Dynamic HTML String [closed]
- How to Parse an Array of Elements in Gutenberg Block
- Can’t get JS code to work with shortcode
- Using the component outside the editor. select(‘core’) is null
- Gutenberg is there a way to know if the current block is reusable?
- How to allow core Gutenberg blocks selection only when you are inside a custom inner block
- How do I add a javascript file to all admin pages via a plugin?
- Mixing Regular Javascript With jQuery in a Plugin
- How to create multiple Gutenberg blocks in one plugin
- How to get color name in PanelColorSettings in custom Gutenberg block?
- Where to call wp_enqueue_script in a plugin with custom template?
- Gutenberg Block showing invalid content on edit
- WordPress Plugin with a shortcode that dynamically generates javascript. Can I use add_action without wrapping the javascript in a function?
- Is there an additional block.json property to set to get an InnerBlocks child to respect the “supports” property?
- How to setAttributes in Gutenberg block?
- How to override gutenberg paragraph block edit property
- What’s the right way to instantiate new blocks and/or the plugin itself in toto when using wppb architecture?
- “import declarations may only appear at top level of a module” when importing WooCommerce API node module
- How can I get the selected string when using a toolbar button in Gutenberg?
- wp.template() returns tags in Ajax response
- My WordPress plugin cannot load my JavaScript file
- Gutenberg table block with Bootstrap .table class
- How to add a gradient component to a custom block
- Run JavaScript validation script on form submit in plugin
- Custom Plugin – CSS works, JS doesn’t
- How to add template colors to custom block options in WordPress Gutenberg editor sidebar?
- How to use apiFetch to get author information in Gutenberg properly?
- Gutenberg blocks error: Each child in a list should have a unique “key” prop
- How to add a panel/box/widget/are/screen to the right side of edit post/page confusion
- Service Worker Uncaught (in promise) DOMException
- How to properly package a block plugin
- Setting global block attribute value
- About a programming language starts with [closed]
- Should I put my plugin javascript inline?
- Modify custom block plugin without losing content
- Custom Block Not Shown in Block Inserter
- When setting styles to an extended block that was saved as a pattern, it doesn’t remove the style that was there
- Query String Filtering API
- How to extend SelectControl with data from my theme
- Multiple TinyMCE on button click is initialized and appended but why only last one is writeable?
- Gutenberg block breaks when showing new data
- How to re-render inspector controls?
- jQueryUI draggable doesn’t work in WordPress plugin
- Get value of custom checkbox from Gutenberg sidebar in plugin
- Where to save Gutenberg plugin data?
- Gutenberg component in a plugin admin
- Append php file to footer
- XMLHttpRequest to open PHP file responds with Missing Page
- Add custom html classes to gutenberg wrapper
- Filterable posts using categories
- Render raw html in Gutenberg block
- Build a dynamic block using the default attributes
- How can create a custom plugin to call my webapi after any registration or membership plugin functionality
- How to replace content of a block in and re-render on change?
- extending a core block doesn’t work inside the editor
- Trouble Importing whatsapp-web.js in a WordPress Plugin Development
- how to add contact form 7 shortcode in javascript variable
- WordPress 6.6.1 – Trying to make a block but receive error, “! Cannot read property ‘then’ of undefined”
- Template locked block does not show appender
- Access DOM Element in Gutenberg Block on WP Admin Post Edit Screen
- Custom Gutenberg Block ‘Stylized List’ – Incorrect Rendering and Looping of List Items
- Gutenberg Static blocks: viewScript doesn’t import css for frontend?
- Custom Gutenberg block with nested InnerBlocks renderAppender not displaying add button
- how to include an image in the build of a multi block plugin
- Insert Button in to the Block Editor (Header) Toolbar