Skip to content

Instantly share code, notes, and snippets.

@evasconcelos
Created March 30, 2021 08:18
Show Gist options
  • Save evasconcelos/d93a03be1965b2569401ccf68b17af01 to your computer and use it in GitHub Desktop.
Save evasconcelos/d93a03be1965b2569401ccf68b17af01 to your computer and use it in GitHub Desktop.
Breaking Interface segregation principle
interface CatFactData {
facts: string[];
color: string;
link: string;
}
const CatFact = ({ facts }: CatFactData) => {
return (
<ul>
{facts.map((fact) => (
<li>{fact}</li>
))}
</ul>
);
};
export default () => {
const catFactData: CatFactData = {
facts: [
"Cats make about 100 different sounds. Dogs make only about 10.",
"I don't know anything about cats.",
"Domestic cats spend about 70 percent of the day sleeping and 15 percent of the day grooming."
],
color: "red",
link: "https://github.com/"
};
return (
<div>
<CatFact {...catFactData} />
</div>
);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment