Skip to content

Commit e5a8c84

Browse files
committed
C 02 Props
1 parent 2a8f866 commit e5a8c84

4 files changed

+34
-6
lines changed

src/chapters/C01_Problem.tsx src/chapters/C01_Navigation_Problem.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Chapter 01: Finding the correct types by navigating between type definitions
22

3-
const C01_Problem = () => {
3+
const C01_Navigation_Problem = () => {
44
return (
55
<div
66
// type for aria-autocomplete ?
@@ -10,12 +10,12 @@ const C01_Problem = () => {
1010
// type for onClick ?
1111
onClick={}
1212
>
13-
C01_Problem
13+
C01_Navigation_Problem
1414
</div>
1515
)
1616
}
1717

18-
export default C01_Problem
18+
export default C01_Navigation_Problem
1919

2020
// 💡 Tips: How to Navigate between type files ?
2121
// Go to the type file and press F12 or Cmd + Click to navigate to the type file from the component file.

src/chapters/C01_Solution.tsx src/chapters/C01_Navigation_Solution.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Chapter 01: Finding the correct types by navigating between type definitions
22

3-
const C01_Solution = () => {
3+
const C01_Navigation_Solution = () => {
44
return (
55
<div
66
// type for aria-autocomplete ?
@@ -12,12 +12,12 @@ const C01_Solution = () => {
1212
console.log(e)
1313
}}
1414
>
15-
C01_Solution
15+
C01_Navigation_Solution
1616
</div>
1717
)
1818
}
1919

20-
export default C01_Solution
20+
export default C01_Navigation_Solution
2121

2222
// 💡 Tips: How to Navigate between type files ?
2323
// Go to the type file and press F12 or Cmd + Click to navigate to the type file from the component file.

src/chapters/C02_Props_Problem.tsx

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// Chapter 02: Add Proper Types to Props
2+
3+
const Child = (props: Props) => {
4+
const { color } = props
5+
return <div>{color}</div>
6+
}
7+
8+
const C02_Props_Problem = () => {
9+
return <Child color="red" />
10+
}
11+
12+
export default C02_Props_Problem

src/chapters/C02_Props_Solution.tsx

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Chapter 02: Add Proper Types to Props
2+
3+
type Props = {
4+
color: string
5+
}
6+
7+
const Child = (props: Props) => {
8+
const { color } = props
9+
return <div>{color}</div>
10+
}
11+
12+
const C02_Props_Solution = () => {
13+
return <Child color="red" />
14+
}
15+
16+
export default C02_Props_Solution

0 commit comments

Comments
 (0)