Skip to content

Instantly share code, notes, and snippets.

@tgmarinho
Created April 2, 2018 18:24
Show Gist options
  • Save tgmarinho/de10e1896ecab0e8538176c4d7a3fdbf to your computer and use it in GitHub Desktop.
Save tgmarinho/de10e1896ecab0e8538176c4d7a3fdbf to your computer and use it in GitHub Desktop.
Post no Medium sobre Composição básica de componentes
import React, { Componente } from 'react';
import LikeButton from './likeButton';
import DeslikeButton from './deslikeButton';
class App extends Component {
 
 render () {
  return (
<div>
<LikeButton />
<DeslikeButton />
</div>
  )
 }
}
import React from 'react';
const Button = ({children, handleClick}) => (
 <button onClick={handleClick}>
{children}
 </button> 
);
export default Button;
import React from 'react';
import Button from './button'
const DeslikeButton = () => (
<Button handleClick={() => alert(‘You Deslike It’)}>Descurtir</Button>
 );
import React from 'react';
import Button from './button';
const LikeButton = () => (
   <Button handleClick={() => alert(‘You Like It’)}>Curtir</Button>
 );
export default LikeButton;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment