From 61abb1a500f1084ca865daa07e99065a62113f8e Mon Sep 17 00:00:00 2001 From: Oliver Sand Date: Tue, 19 Jan 2021 10:36:27 +0100 Subject: [PATCH] Update adr006 on using PropsWithChildren --- docs/architecture-decisions/adr006-avoid-react-fc.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/docs/architecture-decisions/adr006-avoid-react-fc.md b/docs/architecture-decisions/adr006-avoid-react-fc.md index 51dcf042da..eecb4ad87a 100644 --- a/docs/architecture-decisions/adr006-avoid-react-fc.md +++ b/docs/architecture-decisions/adr006-avoid-react-fc.md @@ -43,6 +43,15 @@ const GoodComponent = ({ text, children }: GoodProps) => ( {children} ); + +/* Or as a shorthand, if no specifc child type is required */ +type GoodProps = PropsWithChildren<{ text: string }>; +const GoodComponent = ({ text, children }: GoodProps) => ( +
+
{text}
+ {children} +
+); ``` ## Consequences