xxxxxxxxxx
function App() {
return (<div>
<Message text="rando text" />
</div>
);
}
export default App;
type MessageProps ={
text: number
}
function Message({text}: MessageProps)
{
return(<div>
{text}
</div>)
}
/*pop quiz, will the example below work?
type MessageProps ={
text: number
}
Answer: no, will produce an error due to wrong type
*/
xxxxxxxxxx
type Props = {
size: string;
}
const Component = ({ size = 'medium' }: Props) => (
<div className={cn('spinner', size)} />
);