From 61538c27f4076253a5c6d94ffc9940a0cf1d4aee Mon Sep 17 00:00:00 2001 From: Evan Jacobs Date: Fri, 2 Sep 2022 00:08:13 -0400 Subject: [PATCH] fix: incorrect example code --- sections/faqs/html-attribute-warnings.md | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/sections/faqs/html-attribute-warnings.md b/sections/faqs/html-attribute-warnings.md index e466efbb..6e40a7c4 100644 --- a/sections/faqs/html-attribute-warnings.md +++ b/sections/faqs/html-attribute-warnings.md @@ -33,7 +33,7 @@ This will render: Click ``` -React will warn on non-standard attributes being attached such as "red" and "text", which are not valid HTML attributes for the `` element. +React will warn on non-standard attributes being attached such as "red" and "text", which are not valid HTML attributes for the `` element. To fix this, you can use transient props or destructure props: @@ -41,9 +41,8 @@ To fix this, you can use transient props or destructure props: You can use [transient props](https://styled-components.com/docs/api#transient-props) to fix this: - ```jsx -const Link = ({ className, red, text, ...props }) => ( +const Link = ({ className, text, ...props }) => ( {text} @@ -77,9 +76,7 @@ const StyledComp = styled(Link)` This will render: ```html - - Click - +Click ``` When you use argument destructuring, any variables pulled out of the props object will not be included when spread-applying the remaining props (`...props`);