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
- How can you check if you are in a particular page in the WP Admin section? For example how can I check if I am in the Users > Your Profile page?
- How to include jQuery and JavaScript files correctly?
- How to implement color picker from wordpress in my plugin?
- How can I run AJAX on a button click event?
- Add async script
- API to trigger prompt on leaving page
- Adding pre-publish checks with Gutenberg
- How to make repeated component/block in Gutenberg
- Using Primary Color in Plugin Block
- Gutenberg Blocks doesn’t render correctly when using do_blocks
- How to Add a .js file Only in one specific Page Dynamically to Head
- How to get data from WordPress $wpdb into React Gutenberg Blocks Frontend?
- wp_localize_script $handle
- How to prevent loading of all plugin’s resources?
- How to trap “Publish” button to check for meta box validation?
- Pass javascript result to shortcode executer function
- Plugin Sidebar is not Saving Meta Attribute to Post/Page after “Update”
- Use js script from one plugin in another plugin
- WordPress: After Gutenberg plugin migration to block.json the localization/ translations with PolyGlot in JavaScript does not work anymore
- Making a custom widget that includes a tinymce and works in Site Origin Page Builder
- Error : “Updating failed: The response is not a valid JSON response” with custom shortcode
- What’s the better way to add an inline script?
- Is there a better way to implement responsive images than what WordPress uses by default?
- Create custom blocks for bootstrap
- Gutenberg Block add element in the Editor inside InnerBlocks after div – editor-block-list
- Prevent Javascript Facebook SDK Conflicts in plugin
- how to include javascript file and css file in wordpress
- How do you render_callback for register_block_type to a method in another class?
- Why is my javascript not invoked in my hooks except wp_head?
- WordPress Block Development – trouble importing from @wordpress/icons
- Is there an event or an other method that tells me the preview is loaded?
- How to access noticeOperations from withNotices
- How to insert text at the current cursor position in Gutenberg?
- JSX in WordPress Plugin Development
- There is a problem in the gutenberg block I developed. Problem is with withInstanceId
- javascript datatables in a plugin
- Inserting code to HTML view from a pop up initiated from visual view
- Plugin – Make sure jquery is loaded in my settings page plus my JS file
- What action hook can I use to add a JavaScript to a page post using a theme template that is not including get_header() nor get_footer()?
- should i be checking for jquery before enqueing it in a plugin
- Loading custom js file on the admin page through plugin
- Run JavaScript validation script on form submit in plugin
- Catching Gutenberg sidebar switch event
- Use npm and wp-env to make production bundle
- Passing the name of selected color from the custom component to `render_callback`
- 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
- About a programming language starts with [closed]
- Referencing files in JavaScript in WordPress Plugin
- Should I put my plugin javascript inline?
- WordPress – Get Posts with Category data
- var(–text-color) in style.scss works once but not twitch
- wordpress full site editing problem when extending core blocks
- Pass custom props to
- jQueryUI draggable doesn’t work in WordPress plugin
- Dynamically modify content added to table via javascript
- Javascript scroll eventHandler only working when I’m logged in in WordPress
- Replace the WordPress Media Library Uploader
- Pass javascript result to shortcode executer function
- Add language localisation to javascript alert?
- How to display archive by selecting year and then selecting month
- How do I use (or mimic) document.getElementById() on a page loaded from WordPress database?
- Custom plugin not appearing
- Gutenberg’s Popover component position relative to the focused element
- How do I access the contents of WordPress Classic editor in admin area with JavaScript?
- How to get the value entered in the input field in wordpres
- Help interpreting @wordpress/create-block-tutorial-template usage error
- How can I add a custom button to the post editor?
- Block Development: hamburger module throwing error in save function
- Insert meta-description into Yoast-SEO input-field via JavaScript
- Adding a navigation with wp_nav_menu() to a custom block in the site editor
- Why isn’t custom sidebar panel not showing up in the Gutenberg Editor?
- REST API error in block editor for custom templates
- Set srcset on a block image