Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update block API docs with edit/save argument as props #363

Merged
merged 1 commit into from
Apr 4, 2017

Conversation

aduth
Copy link
Member

@aduth aduth commented Mar 31, 2017

Related: #335
Related: #327 (comment)

This pull request seeks to update API docs for blocks to account for changes in edit and save function argument signature in the blocks API. These property values are now treated as components, accepting props if defined as a function (optionally defined as a wp.element.Component class).

Open questions:

  • Is the difference between edit, save accepting a single object vs. encodeAttributes and control's onClick, isActive obvious enough? The latter set of functions have not yet been implemented and are subject to change, but it's not likely they'll be ever be considered as components like edit and save.
  • How should we recommend naming the prop argument? Most notably this affects ES5 implementations, as ES2015+ object destructuring avoids need to name the argument. For now I've used block, though props is more accurate (should we shield developers from this terminology?).

On the up-side, passing block/props/options as a single object argument allows us to room to grow if we decide we need to pass more behaviors to the block render.

@aduth aduth merged commit 16c399d into master Apr 4, 2017
@aduth aduth deleted the update/block-api-props branch April 4, 2017 00:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant