Skip to content

Instantly share code, notes, and snippets.

@royboy789
Created January 18, 2018 16:08
Show Gist options
  • Save royboy789/a0cab8e6a4807f8a11cfd0df61c80b6d to your computer and use it in GitHub Desktop.
Save royboy789/a0cab8e6a4807f8a11cfd0df61c80b6d to your computer and use it in GitHub Desktop.
ES5 vs ES6 edit callback
// the edit callback for wp.blocks.registerBlockTypes()
/**
* ES5
*
*/
edit: function( props ) {
var attributes = props.attributes,
setAttributes = props.setAttributes,
className = props.className,
id = props.id;
return element( 'div', { className: classname }, __( 'Who', 'ex2-plainjs' ) + ': ' + attributes.who )
}
/**
* ES6
*
*/
edit: function({attributes, setAttributes, className, focus, id}) {
return element( 'div', { className: classname }, __( 'Who', 'ex2-plainjs' ) + ': ' + attributes.who )
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment