I've created a custom Button block and want to use it inside other blocks, like CTA or Icon feature. I've saw in some plugins such code, that exports registered block:
export default registerBlockType( 'name_space/button', {
But now i want to import it to another block for future use. Something like that:
import CustomButton from '../custom-button/block';
I've tried include it inside edit
method of another block with {CustomButton}
and <CustomButton />
. But every time i get an error.
I there a way to do such thing?
You can use InnerBlocks for using core or custom blocks in your blocks. Please keep in mind that it can only be used once inside a block.