Skip to content

Instantly share code, notes, and snippets.

@viniciusdacal
Last active March 28, 2017 20:53
Show Gist options
  • Select an option

  • Save viniciusdacal/af2e57b483111dff50792befa89c4fbf to your computer and use it in GitHub Desktop.

Select an option

Save viniciusdacal/af2e57b483111dff50792befa89c4fbf to your computer and use it in GitHub Desktop.
import React from 'react';
import ReactDom from 'react-dom';
function Button({ children, onClick, type = 'button' }) {
return (
<button type={type} className='btn' onClick={onClick} >
{children}
</button>
);
}
function ButtonGroup({ children, onClick }) {
return (
<div className='btn-group'>
<Button onClick={onClick}>Click A</Button>
<Button onClick={onClick}>Click B</Button>
<Button onClick={onClick}>Click C</Button>
</div>
);
}
ReactDOM.render(
<ButtonGroup onClick={() => console.log('You just clicked')} />,
document.getElementById('root')
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment