Created
December 26, 2018 04:48
-
-
Save rajatk16/1a080910fa11e04f2b2c50f06e3843fe to your computer and use it in GitHub Desktop.
This file contains 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 from 'react'; | |
import ReactDOM from 'react-dom'; | |
import HideOrShow from './App'; | |
function Display() { | |
return ( | |
<HideOrShow> | |
{ | |
({isVisible, hide, show}) => ( | |
<div> | |
{isVisible && <img src={require('./meme.jpg')} onClick={hide}/>} | |
<button onClick={show}>Click to Know the Secret</button> | |
</div> | |
) | |
} | |
</HideOrShow> | |
) | |
} | |
ReactDOM.render(<Display/>, document.getElementById('root')); | |
serviceWorker.register(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment