Skip to content

Commit

Permalink
Fix modal component usage example code (#18452)
Browse files Browse the repository at this point in the history
  • Loading branch information
ediamin authored and Soean committed Nov 12, 2019
1 parent b5e5c80 commit 133db23
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/components/src/modal/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,21 +120,21 @@ The following example shows you how to properly implement a modal. For the modal

```jsx
import { Button, Modal } from '@wordpress/components';
import { useState } from '@wordpress/compose';
import { useState } from '@wordpress/element';

const MyModal = () => {
const [ isOpen, setOpen ] = useState( false );
const openModal = () => setOpen( true );
const closeModal = () => setOpen( false );

return (
<>
<Button isDefault onClick={ openModal }>Open Modal</Button>
{ isOpen && (
<Modal
title="This is my modal"
onRequestClose={ closeModal ) }>
<Button isDefault onClick={ closeModal ) }>
onRequestClose={ closeModal }>
<Button isDefault onClick={ closeModal }>
My custom close button
</Button>
</Modal>
Expand Down

0 comments on commit 133db23

Please sign in to comment.