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

Documenting innerBlocks in save function #66689

Merged
merged 1 commit into from
Dec 23, 2024
Merged

Conversation

Lovor01
Copy link
Contributor

@Lovor01 Lovor01 commented Nov 2, 2024

There is an undocumented property 'innerBlocks' of props passed to save function. This change attempts to document it with example of use.

What?

Why?

How?

Testing Instructions

Testing Instructions for Keyboard

Screenshots or screencast

There is an undocumented property 'innerBlocks' of props passed to save function. This change attempts to document it with example of use.
Copy link

github-actions bot commented Nov 2, 2024

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: Lovor01 <lovor@git.wordpress.org>
Co-authored-by: gziolo <gziolo@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@skorasaurus skorasaurus added the [Type] Developer Documentation Documentation for developers label Nov 12, 2024
@gziolo gziolo added the [Feature] Block API API that allows to express the block paradigm. label Dec 23, 2024
Copy link
Member

@gziolo gziolo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice addition, thank you for contributing these explanation.



```jsx
save: ( { attributes, innerBlocks } ) => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like it's a convenient alternative to another way to check inner blocks:

const blockProps = useBlockProps.save( { className } );
const innerBlocksProps = useInnerBlocksProps.save( blockProps );
return (
<figure { ...innerBlocksProps }>
{ innerBlocksProps.children }

I'm not entirely sure what the difference exactly is. However, I wanted to document it for completeness.

@gziolo gziolo added the props-bot Adding this label triggers the Props Bot workflow for a PR. label Dec 23, 2024
@github-actions github-actions bot removed the props-bot Adding this label triggers the Props Bot workflow for a PR. label Dec 23, 2024
@gziolo gziolo merged commit 09eb60e into WordPress:trunk Dec 23, 2024
72 of 76 checks passed
@github-actions github-actions bot added this to the Gutenberg 20.0 milestone Dec 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Block API API that allows to express the block paradigm. [Type] Developer Documentation Documentation for developers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants