Skip to content

Instantly share code, notes, and snippets.

@andykais
Last active February 1, 2017 03:04
Show Gist options
  • Save andykais/3cfe465a6f26ca8bfc4f586ee57cd47e to your computer and use it in GitHub Desktop.
Save andykais/3cfe465a6f26ca8bfc4f586ee57cd47e to your computer and use it in GitHub Desktop.
const React = require('react')
const handleClick = (event) => {
console.log('user clicked!')
console.log(event)
}
const ImageButton = (props) => (
<button onClick={() => handleClick(props.name)}>
<img src={props.src} alt=""/>
</button>
)
const HomePage = () => (
<div>
<ImageButton name='btn1' src="http://placehold.it/120x120&text=image1"/>
<ImageButton name='btn1' src="http://placehold.it/120x120&text=image2"/>
<ImageButton name='btn1' src="http://placehold.it/120x120&text=image3"/>
</div>
)
export default HomePage
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment