‘useSate’ error when using React on the frontend in custom block plugin

I tried your view script, i.e. the code in your view.js file, and it’s true that I also got the same error in question. However, I spotted another error which appeared before the other error, and which explained why that other error appeared: Warning: Invalid hook call. Hooks can only be called inside of the … Read more

Creating my own “recent blog posts” static Gutenberg block, can’t use react hooks in the frontend

That’s not how blocks work, the save component generates static HTML, so you can’t use interactive hooks or state. The important part is that the save component only runs inside the editor on your browser. It does not run in the database, or on the client. You can’t save a react component to the database … Read more

React Plugin Settings Page Localization

adds an admin menu page with a div that React replaces, but the localization inside this React doesn’t work Actually, since you are enqueueing the same script (build/index.js), which is automatically registered by register_block_type(), then in your my_enqueue_admin_scripts() function, just do wp_enqueue_script( ‘my-block-local-editor-script’ ) to enqueue/load the script on your admin menu page. And secondly, … Read more