DEV Community

Discussion on: A Beginners Guide to using Typescript with React

Collapse
 
bmcmahen profile image
Ben McMahen

Cool! I've used FunctionComponent in the past but didn't realize it actually added children for you.

Thanks for the tip!

Collapse
 
bsgreenb profile image
Ben Greenberg 🧢

The React TypeScript cheat sheet recommends doing them using the shorter version of Ben's syntax:

type AppProps = { message: string }; /* could also use interface */
const App = ({ message }: AppProps) => {message};

github.com/typescript-cheatsheets/...