Hi folks,
I’ve been working on a react website and it has become apparent that it’s becoming quite text heavy and so I’d like to switch to a content management system like wordpress.
I’ve written a custom react component that i’d like to embed into a couple of the wordpress pages, and I’m finding this difficult to complete..
I’ve been following the following instructions to make my component:
[https://developer.wordpress.org/block-editor/getting-started/create-block/wp-plugin/])
These instructions funnel the reader down into creating a “block”. The index.js file contains a registration step for the block which is an important step:
\`\`\`
/\*\*
\* Every block starts by registering a new block type definition.
\*
\* u/see
\*/
registerBlockType( metadata.name, {
/\*\*
\* @see ./edit.js
\*/
edit: Edit,
/\*\*
\* @see ./save.js
\*/
save: save,
} );
\`\`\`
Where Edit and save functions are defined elsewhere (by me). The Edit function is my react component and when I upload the plugin to wordpress, it renders in the wordpress editor just fine. But when the wordpress page is displayed, there is nothing rendered to screen.
Am I barking up the wrong tree by creating a “block” ? If so, can you point me in the right direction please?
​
kind regards!
[ad_2]