Skip to content

Instantly share code, notes, and snippets.

@ikr4-m
Created July 28, 2020 13:08
Show Gist options
  • Save ikr4-m/203132682f20f2e0765c9d4906cbb9c8 to your computer and use it in GitHub Desktop.
Save ikr4-m/203132682f20f2e0765c9d4906cbb9c8 to your computer and use it in GitHub Desktop.
Seperti judul filenya
import React, { useState } from 'react'
import Overlay from './Overlay'
function App () {
const [showOverlay, setOverlay] = useState(false)
function triggerOverlay (event) {
event.preventDefault()
showOverlay ? setOverlay(false) : setOverlay(true)
}
return (
<div className="App">
<button onClick={triggerOverlay.bind(this)}>Munculkan overlay!</button>
{showOverlay ? <Overlay /> : null}
</div>
)
}
export default App
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment