Skip to content

Commit 3187b53

Browse files
authored
Add setState example to Basic Prop Types (#575)
1 parent 8ad6239 commit 3187b53

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1126,6 +1126,8 @@ type AppProps = {
11261126
onClick(event: React.MouseEvent<HTMLButtonElement>): void;
11271127
/** an optional prop (VERY COMMON!) */
11281128
optional?: OptionalType;
1129+
/** when passing down the state setter function returned by `useState` to a child component. `number` is an example, swap out with whatever the type of your state */
1130+
setState: React.Dispatch<React.SetStateAction<number>>;
11291131
};
11301132
```
11311133

docs/basic/getting-started/basic-type-examples.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ type AppProps = {
4848
onClick(event: React.MouseEvent<HTMLButtonElement>): void;
4949
/** an optional prop (VERY COMMON!) */
5050
optional?: OptionalType;
51+
/** when passing down the state setter function returned by `useState` to a child component. `number` is an example, swap out with whatever the type of your state */
52+
setState: React.Dispatch<React.SetStateAction<number>>;
5153
};
5254
```
5355

0 commit comments

Comments
 (0)