Last active
July 15, 2020 20:48
-
-
Save ravewebdev/d2a3f732974bf7e73a9862ddfa456558 to your computer and use it in GitHub Desktop.
1.1. Unique Block Identifiers
This file contains 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
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