Skip to content

Commit e85280f

Browse files
committed
Typing props
1 parent 6841897 commit e85280f

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/02-components/04-typing-components.problem.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
import React from "react";
22

3-
export const Button = (props: unknown) => {
3+
// Initially I just declared className :string directly
4+
// Refactored to this approach as I like abstraction and it's more readable:
5+
6+
export interface ButtonProps {
7+
className: string;
8+
}
9+
10+
export const Button = (props: ButtonProps) => {
411
return <button className={props.className}></button>;
512
};
613

0 commit comments

Comments
 (0)