Skip to content

Instantly share code, notes, and snippets.

@JaysonChiang
Last active February 26, 2021 14:15
Show Gist options
  • Save JaysonChiang/eefaa370d99d377cf45ff7ddf387868e to your computer and use it in GitHub Desktop.
Save JaysonChiang/eefaa370d99d377cf45ff7ddf387868e to your computer and use it in GitHub Desktop.
interface ChildProps {
name: string;
onClick: () => void;
}
const Child = ({ name, onClick }: ChildProps) => {
return (
<div>
{name}
<button onClick={onClick}>Click</button>
</div>
);
};
export default Child;
import Child from './Child';
const Parent = () => {
return <Child name="jayson" onClick={() => console.log('test')} />;
};
export default Parent;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment