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 and getdave committed Aug 14, 2024
1 parent ff0fb97 commit 9052296
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

0 comments on commit 9052296

Please sign in to comment.