Created
March 30, 2021 08:18
-
-
Save evasconcelos/d93a03be1965b2569401ccf68b17af01 to your computer and use it in GitHub Desktop.
Breaking Interface segregation principle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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