Skip to content

Instantly share code, notes, and snippets.

@jonstoked
Last active April 5, 2021 17:51
Show Gist options
  • Save jonstoked/c89bbcb5a2a8f1ab151dcaae582f401c to your computer and use it in GitHub Desktop.
Save jonstoked/c89bbcb5a2a8f1ab151dcaae582f401c to your computer and use it in GitHub Desktop.
TypeScript Error
// This React app contains a type-related error.
// Please find it and explain how you would fix it.
import React, { ReactElement } from 'react';
import './App.css';
function Heading({ title }: { title: string }) {
return <h1>{title}</h1>;
}
function Container({ children }: { children: string }): ReactElement {
return <div>{children}</div>;
}
function App() {
return (
<div>
<Container>
<Heading title="Welcome!"></Heading>
<p>Stay a while.</p>
</Container>
</div>
);
}
export default App;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment