Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
1.1. Unique Block Identifiers
registerBlockType( 'rave/initiative-tracker', {
title: __( 'Initiative Tracker', 'initiative-tracker' ),
attributes: {
id: {
type: 'string',
default: '',
},
},
edit: ( props ) => {
const {
attributes: {
id,
},
clientId,
setAttributes,
} = props;
useEffect( () => {
if ( 0 === id.length ) {
setAttributes( {
id: clientId,
} );
}
}, [] );
},
save: () => null,
} );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment