# Typescript React Types

**URL:** https://forum.codewithmosh.com/t/typescript-react-types/28413
**Category:** React
**Created:** [August 27, 2024, 10:51pm UTC](https://forum.codewithmosh.com/t/typescript-react-types/28413 "2024-08-27T22:51:30Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![porgeet](https://avatars.discourse-cdn.com/v4/letter/p/b19c9b/32.png) [@porgeet](https://forum.codewithmosh.com/u/porgeet)
#### Post date: [August 27, 2024, 10:51pm UTC](https://forum.codewithmosh.com/t/typescript-react-types/28413/1 "2024-08-27T22:51:30Z")

</div>

Hey everyone

I’m doing Mosh’s **React 18 for Beginners** course. In _Building Components, Lesson 11_. When passing more complex children as props to a React component (comprising of other HTML elements), Mosh sets the `children` prop to the type `ReactNode`.

My question is, how and where would I find that information? If for example there are more types.

Cheers

---

<div class="post-metadata">

### Author: ![theorion](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.codewithmosh.com/theorion/32/7783_2.png) [@theorion](https://forum.codewithmosh.com/u/theorion)
#### Post date: [August 28, 2024, 1:49am UTC](https://forum.codewithmosh.com/t/typescript-react-types/28413/2 "2024-08-28T01:49:17Z")

</div>

Here is some documentation on react props. This what ya are looking for?

> **[Components and Props – React](https://legacy.reactjs.org/docs/components-and-props.html)**
>
> A JavaScript library for building user interfaces

---

<div class="post-metadata">

### Author: ![porgeet](https://avatars.discourse-cdn.com/v4/letter/p/b19c9b/32.png) [@porgeet](https://forum.codewithmosh.com/u/porgeet)
#### Post date: [August 28, 2024, 6:41pm UTC](https://forum.codewithmosh.com/t/typescript-react-types/28413/3 "2024-08-28T18:41:59Z")

</div>

Thanks for the reply, I probably should have explained it better.

It’s a TypeScript thing, when defining the values of function arguments; one argument that will come from props, is the `children` object. In this example is more than simply some text, it could contain HTML. The TypeScript type is set to `ReactNode`

`interface Props { children: ReactNode; onClose: () => void; }`

Which is an import from react: `import { ReactNode } from "react";`

How do I find out what the `children` object should be?

Cheers

---

<div class="post-metadata">

### Author: ![theorion](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.codewithmosh.com/theorion/32/7783_2.png) [@theorion](https://forum.codewithmosh.com/u/theorion)
#### Post date: [August 29, 2024, 2:16am UTC](https://forum.codewithmosh.com/t/typescript-react-types/28413/4 "2024-08-29T02:16:42Z")

</div>

It’s a tricky topic i’ve tried defining props for a form submission and pass the data to a usestate ended up having to pass a html fotm element instead of my prop and that made it work.

I could use a refresher tbh from the course.
