Last active
January 26, 2020 15:52
-
-
Save bfintal/8fbe8f4ef01f6c05e7fbae0f4b863b80 to your computer and use it in GitHub Desktop.
How to Run Code When the Block Editor Initializes (Gutenberg) https://benjaminintal.com/2020/01/26/how-to-run-code-when-the-block-editor-initializes-gutenberg/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { registerPlugin } from '@wordpress/plugins' | |
import { useEffect } from '@wordpress/element' | |
const doSomething = () => { | |
useEffect( () => { | |
// Do whatever when the block editor is initialized. | |
}, [] ) | |
return null | |
} | |
registerPlugin( 'do-something', { | |
render: doSomething, | |
} ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment