Created
March 7, 2023 12:50
-
-
Save carvalhochris/36b07bbb6450fd872ff2179e0dd1efdb to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React, { useState } from 'react'; | |
| import MyComponent from './MyComponent'; | |
| function MyButton() { | |
| const [showComponent, setShowComponent] = useState(false); | |
| const handleClick = () => { | |
| setShowComponent(true); | |
| }; | |
| return ( | |
| <div> | |
| <button onClick={handleClick}>Show Component</button> | |
| {showComponent && <MyComponent />} | |
| </div> | |
| ); | |
| } | |
| export default MyButton; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment