Skip to content

Instantly share code, notes, and snippets.

@rajatk16
Created December 26, 2018 04:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rajatk16/1a080910fa11e04f2b2c50f06e3843fe to your computer and use it in GitHub Desktop.
Save rajatk16/1a080910fa11e04f2b2c50f06e3843fe to your computer and use it in GitHub Desktop.
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