diff --git a/docs/reference-guides/data/data-core-notices.md b/docs/reference-guides/data/data-core-notices.md index 2097737568bd6e..838c4724a6a0d8 100644 --- a/docs/reference-guides/data/data-core-notices.md +++ b/docs/reference-guides/data/data-core-notices.md @@ -272,35 +272,31 @@ Removes all notices from a given context. Defaults to the default context. _Usage_ -import { \_\_ } from '@wordpress/i18n'; +```js +import { __ } from '@wordpress/i18n'; import { useDispatch, useSelect } from '@wordpress/data'; import { store as noticesStore } from '@wordpress/notices'; import { Button } from '@wordpress/components'; export const ExampleComponent = () => { -const notices = useSelect( ( select ) => -select( noticesStore ).getNotices() -); -const { removeNotices } = useDispatch( noticesStore ); -return ( -\<> - - - - - ); - + const notices = useSelect( ( select ) => + select( noticesStore ).getNotices() + ); + const { removeNotices } = useDispatch( noticesStore ); + return ( + <> + + + + ); }; +``` _Parameters_ diff --git a/packages/notices/src/store/actions.js b/packages/notices/src/store/actions.js index a18af824cfbc0b..1aef3e43f1c028 100644 --- a/packages/notices/src/store/actions.js +++ b/packages/notices/src/store/actions.js @@ -320,6 +320,7 @@ export function removeNotice( id, context = DEFAULT_CONTEXT ) { * @param {string} context The context to remove all notices from. * * @example + * ```js * import { __ } from '@wordpress/i18n'; * import { useDispatch, useSelect } from '@wordpress/data'; * import { store as noticesStore } from '@wordpress/notices'; @@ -347,6 +348,7 @@ export function removeNotice( id, context = DEFAULT_CONTEXT ) { * * ); * }; + * ``` * * @return {Object} Action object. */