Skip to content

Commit

Permalink
fix: ModalButton
Browse files Browse the repository at this point in the history
  • Loading branch information
lucaslarroche committed Feb 12, 2024
1 parent c86233b commit fa44845
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion v2-react-color-schemes-and-modal/src/components/Main.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const Main = (props) => {
<h1>React color schemes and modal</h1>
<p>Switch color schemes and open modals with React.</p>
<ModalProvider>
<ModalButton>Modal</ModalButton>
<ModalButton>Open Modal</ModalButton>
<Modal />
</ModalProvider>
</main>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import React from "react";
import { useModal } from "../contexts/ModalContext";

export default function ModalButton(props) {
export default function ModalButton({ children, ...props }) {
const { handleOpen } = useModal();

return (
<button onClick={handleOpen} {...props}>
Open Modal
{children}
</button>
);
}

0 comments on commit fa44845

Please sign in to comment.