Skip to content

Commit 9461ac9

Browse files
committed
Changed 20.6 solution
1 parent 4fcfd2d commit 9461ac9

File tree

3 files changed

+62
-4
lines changed

3 files changed

+62
-4
lines changed

package-lock.json

Lines changed: 59 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"license": "GPL-2.0",
77
"devDependencies": {
88
"@types/node": "^18.6.5",
9+
"@types/react": "^18.0.27",
910
"chokidar": "^3.5.3",
1011
"cross-fetch": "^3.1.5",
1112
"typescript": "^4.8.3",

src/04-generics-advanced/20.6-reusable-context.solution.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,12 @@ import { CSSProperties } from "react";
22

33
const makeUseStyled = <TTheme = {}>() => {
44
const useStyled = (func: (theme: TTheme) => CSSProperties) => {
5-
// Imagine that this function hooks into a global theme
6-
// and returns the CSSProperties
75
return {} as CSSProperties;
86
};
97

108
return useStyled;
119
};
1210

13-
const useStyled = makeUseStyled<MyTheme>();
14-
1511
interface MyTheme {
1612
color: {
1713
primary: string;
@@ -21,6 +17,8 @@ interface MyTheme {
2117
};
2218
}
2319

20+
export const useStyled = makeUseStyled<MyTheme>();
21+
2422
const buttonStyle = useStyled((theme) => ({
2523
color: theme.color.primary,
2624
fontSize: theme.fontSize.small,

0 commit comments

Comments
 (0)