Skip to content

Commit

Permalink
Fix example of useBlockProps hook (#64363)
Browse files Browse the repository at this point in the history
* Fix example of useBlockProps hook

* chore: tweaks

* chore: updates

Co-authored-by: meteorlxy <meteorlxy@git.wordpress.org>
Co-authored-by: t-hamano <wildworks@git.wordpress.org>
  • Loading branch information
3 people authored Aug 11, 2024
1 parent 81d5d34 commit e0b54b3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 16 deletions.
23 changes: 9 additions & 14 deletions packages/block-editor/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -920,20 +920,15 @@ _Usage_
import { useBlockProps } from '@wordpress/block-editor';

export default function Edit() {

const blockProps = useBlockProps(
className: 'my-custom-class',
style: {
color: '#222222',
backgroundColor: '#eeeeee'
}
)

return (
<div { ...blockProps }>

</div>
)
const blockProps = useBlockProps( {
className: 'my-custom-class',
style: {
color: '#222222',
backgroundColor: '#eeeeee',
},
} );

return <div { ...blockProps }></div>;
}
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,13 @@ import { canBindBlock } from '../../../hooks/use-bindings-attributes';
*
* export default function Edit() {
*
* const blockProps = useBlockProps(
* const blockProps = useBlockProps( {
* className: 'my-custom-class',
* style: {
* color: '#222222',
* backgroundColor: '#eeeeee'
* }
* )
* } )
*
* return (
* <div { ...blockProps }>
Expand Down

1 comment on commit e0b54b3

@github-actions
Copy link

Choose a reason for hiding this comment

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

Flaky tests detected in e0b54b3.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/10339081298
📝 Reported issues:

Please sign in to comment.