import { useState } from 'react';\n\nexport default function Card() {\n const [count, setCount] = useState(0);\n \/\/ ...\n}<\/code><\/pre>\n\n\nThose were my early mistakes!<\/h3>\n\n\n
Maybe \u201cmistake\u201d is too harsh a word since some of the better practices came about later. Still, I see plenty of instances where the \u201cold\u201d way of doing something is still being actively used in projects and other tutorials.<\/p>\n\n\n\n
To be honest, I probably made way more than five mistakes when getting started. Anytime you reach for a new tool it is going to be more like a learning journey to use it effectively, rather than flipping a switch. But these are the things I still carry with me years later!<\/p>\n\n\n\n
If you\u2019ve been using React for a while, what are some of the things you wish you knew before you started? It would be great to get a collection going to help others avoid the same struggles.<\/p>\n","protected":false},"excerpt":{"rendered":"
You know what it’s like to pick up a new language or framework. Sometimes there\u2019s great documentation to help you find your way through it. But even the best documentation doesn\u2019t cover absolutely everything. And when you work with something that’s new, you’re bound to find a problem that doesn’t have a written solution. That\u2019s […]<\/p>\n","protected":false},"author":288730,"featured_media":377100,"comment_status":"open","ping_status":"closed","sticky":true,"template":"","format":"standard","meta":{"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"sig_custom_text":"","sig_image_type":"featured-image","sig_custom_image":0,"sig_is_disabled":false,"inline_featured_image":false,"c2c_always_allow_admin_comments":false,"footnotes":"","jetpack_publicize_message":"","jetpack_is_tweetstorm":false,"jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":[]},"categories":[4],"tags":[870,557],"jetpack_publicize_connections":[],"acf":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2023\/02\/react-facepalm.png?fit=1200%2C600&ssl=1","jetpack-related-posts":[{"id":269385,"url":"https:\/\/css-tricks.com\/how-to-create-a-component-library-from-svg-illustrations\/","url_meta":{"origin":377098,"position":0},"title":"How to Create a Component Library From SVG Illustrations","date":"April 12, 2018","format":false,"excerpt":"I\u2019ve recently published my first ever open source npm package! It makes SVG illustrations from unDraw into customizable React components. Here\u2019s a GIF that shows what I mean: What\u2019s unDraw? While unDraw is still fairly new, its open source nature means that it\u2019s being used by a range of products\u2026","rel":"","context":"In "Article"","img":{"alt_text":"","src":"https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2018\/04\/react-svg-component-featured.jpg?fit=1200%2C600&ssl=1&resize=350%2C200","width":350,"height":200},"classes":[]},{"id":287709,"url":"https:\/\/css-tricks.com\/front-end-documentation-style-guides-and-the-rise-of-mdx\/","url_meta":{"origin":377098,"position":1},"title":"Front-End Documentation, Style Guides and the Rise of MDX","date":"May 23, 2019","format":false,"excerpt":"You can have the best open source project in the world but, if it doesn\u2019t have good documentation, chances are it\u2019ll never take off. In the office, good documentation could save you having to repeatedly answer the same questions. Documentation ensures that people can figure out how things work if\u2026","rel":"","context":"In "Article"","img":{"alt_text":"","src":"https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2019\/05\/mdx.png?fit=1200%2C600&ssl=1&resize=350%2C200","width":350,"height":200},"classes":[]},{"id":321306,"url":"https:\/\/css-tricks.com\/using-markdown-and-localization-in-the-wordpress-block-editor\/","url_meta":{"origin":377098,"position":2},"title":"Using Markdown and Localization in the WordPress Block Editor","date":"September 23, 2020","format":false,"excerpt":"If we need to show documentation to the user directly in the WordPress editor, what is the best way to do it? Since the block editor is based on React, we may be tempted to use React components and HTML code for the documentation. That is the approach I followed\u2026","rel":"","context":"In "Article"","img":{"alt_text":"","src":"https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2020\/09\/markdown-locale-wordpress.png?fit=1200%2C600&ssl=1&resize=350%2C200","width":350,"height":200},"classes":[]},{"id":305290,"url":"https:\/\/css-tricks.com\/an-introduction-to-mdxjs\/","url_meta":{"origin":377098,"position":3},"title":"An Introduction to MDXJS","date":"March 25, 2020","format":false,"excerpt":"Markdown has traditionally been a favorite format for programmers to write documentation. It\u2019s simple enough for almost everyone to learn and adapt to while making it easy to format and style content. It was so popular that commands from Markdown have been used in chat applications like Slack and Whatsapp\u2026","rel":"","context":"In "Article"","img":{"alt_text":"","src":"https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2020\/03\/mdx.png?fit=1200%2C600&ssl=1&resize=350%2C200","width":350,"height":200},"classes":[]},{"id":281513,"url":"https:\/\/css-tricks.com\/react-16-6-0-goodies\/","url_meta":{"origin":377098,"position":4},"title":"React 16.6.0 Goodies","date":"January 23, 2019","format":false,"excerpt":"React 16.6.0 was released October 2018 and with it came goodies that spice up the way we can develop with React. We\u2019re going to cover what I consider the best of those new goodies with examples of how we can put them to use in our work. React.memo() avoids unnecessary\u2026","rel":"","context":"In "Article"","img":{"alt_text":"","src":"https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2018\/04\/react.jpg?fit=1200%2C600&ssl=1&resize=350%2C200","width":350,"height":200},"classes":[]},{"id":307780,"url":"https:\/\/css-tricks.com\/working-with-mdx-custom-elements-and-shortcodes\/","url_meta":{"origin":377098,"position":5},"title":"Working With MDX Custom Elements and Shortcodes","date":"May 7, 2020","format":false,"excerpt":"MDX is a killer feature for things like blogs, slide decks and component documentation. It allows you to write Markdown without worrying about HTML elements, their formatting and placement while sprinkling in the magic of custom React components when necessary. Let\u2019s harness that magic and look at how we can\u2026","rel":"","context":"In "Article"","img":{"alt_text":"","src":"https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2020\/03\/mdx.png?fit=1200%2C600&ssl=1&resize=350%2C200","width":350,"height":200},"classes":[]}],"featured_media_src_url":"https:\/\/i0.wp.com\/css-tricks.com\/wp-content\/uploads\/2023\/02\/react-facepalm.png?fit=1024%2C512&ssl=1","_links":{"self":[{"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/posts\/377098"}],"collection":[{"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/users\/288730"}],"replies":[{"embeddable":true,"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/comments?post=377098"}],"version-history":[{"count":5,"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/posts\/377098\/revisions"}],"predecessor-version":[{"id":377106,"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/posts\/377098\/revisions\/377106"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/media\/377100"}],"wp:attachment":[{"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/media?parent=377098"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/categories?post=377098"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/css-tricks.com\/wp-json\/wp\/v2\/tags?post=377098"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}