One place for hosting & domains

      36 Brilliant Blogging Tools to Help You Write Better, Publish More, and Increase Traffic


      Affiliate Disclosure: DreamHost maintains relationships with some of our recommended partners, so if you click through a link and purchase, we may receive a commission. We only recommend solutions we believe in.

      Running a blog can be tough. There are times when it can feel like having multiple jobs. Not only do you need to create fresh, high-quality content, but you’ll also have a website to manage, social media posts to schedule, and data to analyze.

      Having a versatile bag of tools at your disposal can keep your blogging gig from becoming overwhelming. There are solutions for most of your day-to-day tasks, from design to Search Engine Optimization (SEO) and everything in between.

      With all the possibilities to choose from, you could spend weeks just combing through your options. So we’ve done the hard work for you. In this article, we’ll cover why you need the right tools. Then we’ll detail 36 brilliant blogging solutions worth checking out. Let’s get started!

      Why You Need the Right Blogging Tools

      As a blogger, you’ll want to find tools that help you become more productive and successful. For example, discovering topics to blog about that your audience will love can be tricky. The right solution can help you brainstorm ideas and explore new niches you weren’t previously aware of, saving you a lot of time in the process.

      What’s more, there’s more to blogging than just writing. You need to be sure people can discover and share your website. Therefore, to maximize your reach, you’ll want to look into blogging tools that give your SEO and social media a boost. This can make up for any lack of knowledge or experience on your end, and free up your attention for your actual content.

      36 Brilliant Blogging Tools to Help You Write Better, Publish More, and Increase Traffic

      We’ve argued the case for having the right blogging tools at the ready. Now let’s explore 36 of the top options and see what they can do.

      Research

      Content creation requires lots of research. You need to be sure people are searching for what you’re going to be writing about. You’ll also need someplace to keep ideas and notes.

      1. Google Keyword Planner

      The Google Keyword Planner home page.

      Before you start writing a new blog post, you might want to make sure you’re using words that people are searching for. Google Keyword Planner can provide you with feedback on your potential keywords.

      This great tool will help you by showing you how popular each chosen keyword is through search volume metrics. You’ll also get some suggestions for other relevant phrases you may want to use.

      Price: Google Keyword Planner is free to use, as long as you have a Google Ads account set up.

      2. Google Trends

      The Google Trends website.

      When trying to nail down an idea for a successful blog post, you might want to start with Google Trends. You can enter any topic into the search box, and this tool will provide you with a ton of information and history about it.

      You can filter your results, which is especially useful if you’re trying to capture a particular region’s attention. Google Trends also provides you a list of related topics, which you can use to brainstorm more content ideas.

      Price: Google Trends is entirely free for anyone to use.

      3. BuzzSumo

      The BuzzSumo website.

      If you’re wondering what’s trending in your niche, BuzzSumo can tell you. Just search for the topic you’re interested in, and you’ll get a list of the top-performing content in that area.

      You can also enter the URL for one of your competitors. BuzzSumo will give you a list of the top-performing content from that site, so you can see what’s resonating with your potential audience.

      Price: BuzzSumo offers a seven-day free trial. After that, you can choose from several tiers starting at $79 per month.

      4. HubSpot’s Blog Ideas Generator

      HubSpot’s Blog Ideas Generator.

      When you start blogging, it’s hard to imagine ever running out of ideas. However, the day will likely come when you sit down to write and come up empty. That’s where HubSpot’s Blog Ideas Generator comes into the picture.

      Provide the generator with up to five nouns, and it will return a week’s worth of blog ideas. If you need a year’s worth of topics, you can enter some details and unlock 250 more potential blog posts.

      Price: The Blog Ideas Generator is free for anyone to use. But, if you want more ideas at once, you’ll have to trade some information to get them.

      5. EvernoteThe Evernote website.

      With all those new blog post ideas, you’re going to be doing a lot of research. If your bookmarks bar is becoming a disorganized mess, Evernote can provide a place to keep all of your screenshots, notes, and articles.

      What if you prefer a mix of handwritten and electronic notes? You can actually scan your notes with your phone into the app. You can even search these scanned documents since Evernote can read handwriting.

      Price: Evernote has several plans to choose from, including a robust free version. You can upgrade to one of the paid versions starting at $7.99 per month.

      Writing and Grammar

      Well-written, readable content is crucial for a successful blog. Even the most compelling ideas will suffer without the right words to convey them.

      6. Grammarly

      The Grammarly writing tool.

      Even the strongest writer can benefit from having a second pair of eyes look over their blog posts. Grammarly is like having an experienced editor making suggestions to improve your writing and style.

      Each time you open a new document in Grammarly, you can set goals for its tone, formality, and intent. You’ll then receive feedback to help you hit those targets. Grammarly also has a Chrome extension, so you can check your emails and Google Docs as well.

      One downside: Grammarly is currently only available in English. If you’re looking for a multilingual grammar checker, consider Language Tool, which can check your writing in more than 20 languages. It’s what our team uses to review Spanish content.

      Price: Grammarly’s free plan checks your grammar, spelling, and conciseness. The premium tier adds more style and genre checks (as well as a plagiarism detector) for $11.66 per month.

      7. Associated Press (AP) Stylebook

      The Associated Press Stylebook.

      The Associated Press (AP) Stylebook is a reference every blogger should have on their bookshelf. Using AP style for blog posts can help to keep them concise, clear, and informative.

      The AP Stylebook is updated frequently. If you buy the book from the official website, you’ll receive email notifications about these changes. It’s a simple way to keep up with stylistic adjustments.

      Price: You have multiple options for purchasing the AP Stylebook. A spiral-bound physical copy will cost you $26.95. The online stylebook starts at $22.00 for one user.

      8. Google Docs

      The Google Docs home page.

      Google Docs is a web-based word processor. You can use this application to compose, edit, and format your blog posts.

      One advantage of Google Docs is that you can access your documents anywhere, regardless of your device. For a blogger on the go, this is a must-have feature!

      Price: Google Docs is free to use. You can upgrade to G Suite for additional features and applications, starting at $6 per month.

      Project Management

      Blogs have a lot of moving parts. Project management tools can help you stay organized, so your blogging tasks stay on track.

      9. Asana

      The Asana project management tool.

      Asana enables you to build a roadmap for your blog projects. You can group tasks to make up a project or divide them into smaller chunks.

      If you collaborate with other writers on your blog, Asana is a powerful tool for team management. You’re able to see at a glance where each post is in your pipeline.

      Price: Asana’s free option allows collaboration with up to 15 people. Premium plans begin at $10.99 per user per month.

      10. Trello

      The Trello productivity tool.

      Trello’s design is based on cards, lists, and boards. It’s an intuitive system that can hold a ton of information.

      Trello is an excellent alternative to Asana if you’re looking for something a little more streamlined. You can keep all the attachments and notes you need for a task on its card. This format is also easier to handle if you’re a team of one.

      Price: Trello has a robust free option that enables you to have an unlimited number of personal boards and ten team boards. Upgraded plans begin at $9.99 per user per month.

      Design

      Gorgeous visuals to complement your words are an essential part of creating branded, shareable blog posts. You don’t need to be an artist, but the right tools can help you fake it.

      11. Adobe Photoshop

      The Adobe Photoshop website.

      When you think of photo editing software, Adobe Photoshop probably comes to mind. Whether you’re touching up a stock photo or creating a new logo, you can probably do it with Photoshop.

      One exciting aspect of this platform is that new features are always being added. One of the latest is the object selection tool. You can lasso or draw a rectangle around an object, and the selection snaps into place around it.

      Price: You can try Adobe Photoshop for free for seven days. After that, plans start at $20.99 per month.

      12. Canva

      The Canva photo editing tool.

      Canva is like Photoshop’s younger but no less accomplished sister. The free plan gives you generous access to templates, stock photos, and other design elements. However, Canva Pro contains some valuable features as well.

      With a Brand Kit, for example, you can collect the colors, fonts, and logos that make your blog recognizable all in one place. Imagine the time you could save on looking up HTML color codes!

      Price: You can upgrade to Pro for $9.95 per month. There’s also a 30-day free trial.

      13. Logaster

      The Logaster home page.

      Are you struggling to come up with a logo? If so, Logaster can generate a variety of options to choose from in seconds. Just enter your blog’s name and scroll through the possibilities.

      If you’d like, you can give Logaster more information to build your logo with. For instance, you can try specifying a color and industry for more personalization. If you’re not entirely happy with the design, you can do some editing by signing up for a free account.

      Price: You can download and use the small version of your new logo for free. However, Logaster also offers packages that include different size logos, letterheads, favicons, and more. These range from $19.99 to $89.99.

      Search Engine Optimization (SEO)

      SEO has many different facets that all need your attention. The following tools can help you analyze and optimize your blog’s content, so you’ll have a fighting chance for higher rankings.

      14. Yoast SEO

      The Yoast SEO plugin.

      If you have a blog on WordPress, you’ll probably want to install the Yoast SEO plugin. This tool makes optimizing each of your posts easy.

      For example, you can give Yoast SEO a keyphrase, and it will return actionable advice that you can use to improve your post. The premium version can even account for other forms of that keyphrase, including synonyms and plurals.

      Price: You can get started with the free version or go all-in with Yoast SEO Premium. The latter starts at $89 for one site.

      15. SEMrush

      The SEMRush website.

      It might be unfair to give SEMrush only one spot on this list, as it provides multiple tools. SEMrush offers insights on everything from social media to Pay-Per-Click (PPC) advertising.

      Most importantly, however, SEMrush’s SEO Toolkit can give you an edge over your competition. The Domain Overview lets you see which keywords your competitors use. You can use this information to hone your content plan over time.

      Price: SEMrush plans range from $83.28 to $333.28 per month. Higher tiers get you access to more reports and extended limits. The good news? We’ve worked out a free SEMrush trial for our readers, so you can see if this tool is a good fit for your blog without a long-term commitment!

      SEMrush

      16. MarketMuse

      The MarketMuse solution.

      MarketMuse is a complete, AI-based solution for content. This tool can lend a hand with anything from research to content creation.

      The ability to optimize content can make MarketMuse a valuable part of your blogging strategy. Its AI analyzes your copy and makes suggestions for the language you should use. This can boost your SEO rankings, as you’ll be using the same words your audience uses to search.

      Price: You can try MarketMuse’s Pro plan free for a month. After that, the cost is $325 per month.

      17. Ahrefs

      The Ahrefs SEO tool.

      Ahrefs is an invaluable resource if you’ve been blogging for a while and want to move to the next level. This SEO toolset can help you maximize your efforts.

      While Ahrefs offers a wide range of features, it started as a backlink checker and still excels at that task. The Content Explorer tool analyzes individual pieces of content and displays how many backlinks they receive over time.

      Price: Ahrefs offers a seven-day trial for $7. Full plans start at $82 per month for a single user.

      18. Can I Rank?

      The Can I Rank tool.

      Can I Rank may be the next best thing to hiring an analyst. This tool uses AI to deliver actionable insights that can help you improve your blog’s SEO.

      To do this, Can I Rank’s reports provide steps towards ranking for your target keywords. You’ll get suggestions for improving your current content, and new keywords you may want to focus on going forward. The AI will also connect you to other SEO tools that may be helpful.

      Price: Can I Rank has a free plan, which limits how many times you can access each report. Paid plans start at $49 per month, and a free trial is available.

      19. Ubersuggest

      The Ubersuggest Chrome extension.

      Installing the Ubersuggest Chrome extension gives you access to SEO metrics and insights every time you search.

      Ubersuggest can help refine keywords that you’ve researched. If you perform a search with one of your target keywords, you’ll receive a list of related target phrases, along with the search volume for the current month and the estimated competition for the keyword.

      Price: This extension is free. You don’t even need to create an account, although you’ll gain access to more features if you do so.

      20. LinkMiner

      The LinkMiner extension.

      Broken links can hurt your site’s SEO. They’re easy to fix but not always simple to find. Fortunately, the LinkMiner Chrome extension unearths broken links for you.

      This extension provides you with overall results for each page you analyze. It also highlights all the links in your content in red, so you can get them fixed right away.

      Price: You can use this extension for free.

      Site Management

      A user-friendly CMS can make managing your website much more straightforward. When you pair that with reliable hosting, you’ll have a solid foundation for your blog.

      21. WordPress

      The WordPress.org home page.

      WordPress powers 37% of all sites on the internet, and for good reason. This free, open-source platform is powerful, flexible, and supported by an active community.

      One appealing feature for bloggers is the Block Editor. This editor makes it easy to create stunning, rich content, with no design or coding experience necessary. The drag-and-drop interface makes it possible to rearrange your content and experiment with different possibilities.

      Price: WordPress itself is free. You’ll just have to pay for a hosting plan. You can also choose to purchase premium themes and plugins.

      22. A Managed WordPress Hosting Plan

      DreamHost managed WordPress hosting.

      You’ll probably get more out of WordPress if you complement it with a managed WordPress hosting plan. These specialized plans come with extras that can make your website building and upkeep a lot easier.

      After all, just because you’re a blogger doesn’t mean you’re a web designer. That’s why our DreamPress managed hosting plans include a website builder specifically designed for WordPress sites. After you’ve created your site, we’ll keep it safe by performing daily and on-demand backups.

      Price: Managed WordPress hosting can vary in cost depending on your provider. Our hosting plans start at $16.95 per month.

      Blog Better with DreamPress

      Our automatic updates and strong security defenses take server management off your hands so you can focus on content creation.

      23. Wordable

      The Wordable plugin.

      As awesome as the Block Editor is, there are advantages to composing your blog posts in Google Docs. However, you’ll lose a lot of time copying and reformatting your posts before publishing them.

      The Wordable plugin accomplishes all of those tasks in a single click. Wordable doesn’t just import text; it also brings along the images and headings. You can have guest writers submit their pieces as Google Docs and import them with Wordable. You don’t have to set up an account on your site for them, and you won’t have to reformat their posts either.

      Price: You can test out Wordable with a three-export trial. After that, plans start at $19 per month for one user and one WordPress site.

      Social Media

      Handling multiple social media channels can create confusion and the potential for mistakes. To avoid that, you can stay on top of your social media schedule with the help of these tools.

      24. CoSchedule

      The CoSchedule plugin.

      CoSchedule is the editorial calendar of your dreams. It can help you manage blog posts and get them onto social media platforms.

      CoSchedule’s Blog Calendar lets you see your scheduled blog and social media posts in one place. If you need to reschedule a post, you can just drag and drop it wherever you’d like. The calendar automatically adjusts the accompanying social media messages.

      Price: You can get the Blog Calendar for $14 per month. If you’d like to add more functionality with the Marketing Calendar, the price increases to $29 per month.

      25. Social Snap

      The Social Snap plugin.

      Social Snap is a social media plugin for WordPress. This solution comes with a suite of tools designed to get more traffic to your blog.

      With Social Snap, you can place social sharing buttons anywhere in your blog posts. The floating sidebar could be an effective strategy if you tend to write longer content. You can also customize the buttons to match your website’s design.

      Price: Social Snap offers plans starting at $27.30 per year. There is no free trial, but there is a 30-day money-back guarantee.

      26. Buffer

      The Buffer platform.

      If you’re in the market for a complete social media solution, you may want to check out Buffer. This platform provides tools to help you publish and analyze your content.

      Buffer’s Publish tool enables you to manage all of your social media channels from one dashboard. With some determination and a lot of coffee, you might schedule a month’s worth of content in a single afternoon.

      Price: Buffer Publish begins at $12 per month. The Pro plan enables you to schedule up to 100 posts.

      27. Click to Tweet

      The Click to Tweet plugin.

      Click to Tweet is a free plugin provided by CoSchedule. If you have your eyes set on the Twitterverse, you’ll likely want this blogging tool at your side.

      With it, you can pull out especially tweet-worthy wisdom from your content. Your readers can then share these insights with their followers in one click.

      Price: Click to Tweet is free to download and use. You do need to provide some personal information and sign up for CoSchedule’s mailing list to access the tool.

      Video

      You may already include video on your blog, as it can increase the time visitors spend on a page. If not, these solutions can get you started.

      28. YouTube

      The YouTube home page.

      You may already use YouTube to host your videos, but there’s more you can do with the platform. For example, did you know that you can live stream with YouTube?

      Live streaming is a fun way to connect with your audience and has been growing in popularity in recent years. It’s a great way to build a sense of community around your blog.

      Price: YouTube is free to use. All you need is a Google account.

      29. Adobe Premiere Rush

      The Adobe Rush website.

      If creating video content sounds like a lot of work, you can check out Adobe Premiere Rush. This helpful tool makes producing a video (almost) as easy as posting to social media.

      With Adobe Premiere Rush, you can capture and edit footage right from your mobile phone. You can even add graphics, overlays, and voiceovers. Then you’ll be able to share the video to your YouTube channel, Instagram account, Facebook page, and other social media platforms.

      Price: Adobe Premiere Rush offers a free trial that limits you to three exports. After that, you can access the software for $9.99 per month.

      Analytics

      By keeping an eye on your blog’s statistics, you’ll be able to see where you can improve. If you’re not a data analyst, you might appreciate some help in that department.

      30. Google Analytics

      The Google Analytics website.

      If you haven’t already installed Google Analytics on your blog, what are you waiting for? Its many tools will give you access to the metrics you need for running a successful blog.

      While your hosting provider may provide you with some traffic data, Google Analytics offers you a wide range of numbers. Knowing where your traffic is coming from will help you focus your efforts on those channels.

      Price: Google Analytics is free to use. You just need to add a tracking code to your website.

      31. MonsterInsights

      The MonsterInsights plugin.

      MonsterInsights is a plugin that helps make Google Analytics even more powerful. It’s a match made in blogging heaven.

      A favorite feature of MonsterInsights is the Google Analytics dashboard. Instead of navigating away from WordPress, you can view all that data right in your admin dashboard. You’ll also be able to see what’s happening on your blog in real-time.

      Price: MonsterInsights plans begin at $99.50 per year. There’s no free trial, but there is a 14-day money-back guarantee.

      Marketing Your Blog

      Having the best content on the web won’t do you any good if no one knows it exists. Fortunately, you can get your blog in front of more people with these tools.

      32. OptinMonster

      The OptinMonster plugin.

      As a blogger, convincing readers to sign up for your email newsletter is critical. OptinMonster can help you create opt-in campaigns that turn casual readers into devoted fans.

      If your opt-in isn’t user-friendly, it’s unlikely to convert. OptinMonster gives you powerful targeting options, such as device-based targeting. This ensures that mobile users only see campaigns that are optimized for their devices.

      Price: OptinMonster’s basic plan will cost you $9 per month.

      33. Hunter

      The Hunter tool.

      Guest posting is a tried-and-true link building technique for bloggers. Crafting a strong pitch is hard enough, but sometimes the most challenging part is finding the right email to send it to.

      To make things easier, you can simply enter a domain name into Hunter’s search box, and the tool returns every email address it can find for that company. You can use this to see a particular individual’s email or search for a role, such as “submissions@” or “editorial@”.

      Price: You can perform 50 free searches per month. Paid plans start at $34 per month.

      34. NinjaOutreach

      The NinjaOutreach platform.

      Partnering with an influencer can increase your blog’s audience. NinjaOutreach enables you to filter through lots of influencers in your niche, so you can find the right one.

      Whether you’re targeting Instagram, Twitter, TikTok, or YouTube, NinjaOutreach has you covered with its extensive database of influencers. You can even find other bloggers who may be interested in collaboration.

      Price: NinjaOutreach offers a 7-day free trial. A monthly plan starts at $119.

      35. Mailchimp

      The Mailchimp platform.

      There’s more to email marketing than sending out a blast whenever you publish a new post. Mailchimp helps you organize your list and send out updates on time.

      No one wants to read ugly emails, but thanks to Mailchimp’s drag-and-drop builder, you can make customizations and even add images and videos. Then, real-time analytics lets you monitor how effective your campaigns are.

      Price: Mailchimp offers a generous free plan to get you started. You can get an upgraded email-only plan for $9.99 per month.

      36. Teachable

      The Teachable home page.

      Sharing your knowledge is an effective way of establishing yourself as an expert in your blogging niche. Unfortunately, setting up an online course can be a challenge.

      Teachable is a complete solution for building and running an online course. You can make your lessons extra special by taking advantage of Teachable’s live features. For example, you can schedule one-on-one sessions with your students to check in on progress and answer questions.

      Price: Teachable’s Basic plan comes with everything you need to create your first course, and costs $29 per month.

      11 Blogging Tools We Use on the DreamHost Blog

      While all of the blogging tools on this list are excellent, we have some favorites we use for the DreamHost blog itself. Here’s some extra love for the solutions that make our job so much easier:

      1. Google Docs: When it comes to collaboration, you can’t beat Google Docs.
      2. Grammarly: Even the most seasoned writers miss an Oxford comma from time to time.
      3. Language Tool: This is a useful grammar checker if you need support in languages other than English. We use it for our Spanish content!
      4. MarketMuse: If you love the content on our blog, we have to give some credit to MarketMuse.
      5. WordPress: Like so much of the internet, we love how easy WordPress is to use. It really is our favorite blogging tool!
      6. DreamPress Hosting: Not to toot our own horn, but we’re really good at this hosting thing.
      7. OptinMonster: No one wants to annoy their blog visitors with unwanted opt-ins, and we’re no exception.
      8. Yoast SEO: We’re proud of what we publish, and Yoast SEO helps ensure that our blog content gets seen by plenty of visitors.
      9. CoSchedule: Keeping track of when and where we’ve published our content is much easier thanks to CoSchedule.
      10. Canva: The one-click resize option for various social media channels is a gift.
      11. Google Analytics: We use Google Analytics to be sure we’re giving you more of what you want.

      If you’re not sure where to begin, the above tools should start you off on the right foot.

      Ready to Launch Your WordPress Blog?

      Whether you need help choosing a blogging platform, understanding affiliate marketing, or picking a WordPress theme, we can help! Subscribe to our monthly digest so you never miss an article.

      What’s Your Next Blogging Tool?

      Handling a blog on your own is a difficult task. Taking advantage of a few of the many blogging tools available can give you back some valuable time.

      Today, we’ve looked at a few reasons why you might want to invest in some blogging tools. If you’re just getting started with your blog, you might try out Google Docs and Grammarly to keep your content organized and polished. If you’re ready to step up your marketing game, Mailchimp can give you the edge you’re looking for.

      Ready to put those new blogging tools to work? It may be a smart time to upgrade your hosting service, to prepare for all the new traffic you’ll be getting. Check out our managed WordPress hosting plans!



      Source link

      Handy Networking Tools and How to Use Them


      How to Join

      This Tech Talk is free and open to everyone. Register on Eventbrite here to receive a link to join on Tuesday, October 20, 2020, 12:00–1:00 p.m. ET.

      About the Talk

      When I joined the networking team at DigitalOcean a few years ago, I dove into an entirely different world of software-defined networking in the data center. Virtual switches, networking protocols — these were concepts that I had encountered at the surface level before — but now I frequently found myself debugging them. With time, I came to rely on a variety of Linux networking tools for introspecting, troubleshooting, and examining network state. In this talk, I’ll share some of my favorite Linux networking tools and discuss scenarios in which they are quite helpful.

      What You’ll Learn

      Situations in which popular Linux networking tools can be leveraged.

      This Talk is Designed For

      Anyone who has a basic understanding of software engineering and may deal with networking issues.

      Prerequisites

      Basic understanding of software engineering and the command line/terminal.

      About the Presenter

      Sneha Inguva is a Software Engineer on the networking team at DigitalOcean. She enjoys building cloud products by day and debugging ominous context-cancelled errors by night. Her journey through this fantastical field has taken her from casino gaming to 3D-printing startups to the cloud world. In her spare time, she takes high-fashion photographs of cats in nature.

      To join the live Tech Talk, register here. If you can’t make the live event, the video recording will be published here as soon as it’s available.



      Source link

      How To Debug React Components Using React Developer Tools


      The author selected Creative Commons to receive a donation as part of the Write for DOnations program.

      Introduction

      Since React apps are made to scale and grow quickly, it’s easy for subtle bugs to infiltrate your code. The React Developer Tools browser extension can help you track down these bugs by giving you more insight into the current state for each component. React Developer Tools gives you an interface for exploring the React component tree along with the current props, state, and context for individual components. React Developer Tools also lets you determine which components are re-rendering and can generate graphs to show how long individual components take to render. You can use this information to track down inefficient code or to optimize data-heavy components.

      This tutorial begins by installing the React Developer Tools browser extension. You’ll then build a text analyzer as a test application, which will take a block of text and display information such as word count, character count, and character usage. Finally, you will use React Developer Tools to explore the text analyzer’s components and keep track of the changing props and context. The examples will use the Chrome browser, but you can also use the plugin for Firefox.

      By the end of this tutorial, you’ll be able to start using the React Developer Tools to debug and explore any React project.

      Prerequisites

      In this step, you’ll install the React Developer Tools broswer extension in Chrome. You’ll use the developer tools in the Chrome JavaScript console to explore the component tree of the debug-tutorial project you made in the Prerequisites. This step will use Chrome, but the steps will be nearly identical for installing the React Developer Tools as an add-on in Firefox.

      By the end of this step, you’ll have the React Developer Tools installed in your browser and you’ll be able to explore and filter components by name.

      The React Developer Tools is a plugin for the Chrome and Firefox browser. When you add the extension, you are adding additional tools to the developer console. Visit the Chrome plugin page for React Developer Tools to install the extension.

      Click on the Add to Chrome button. Then click on the Add extension button to confirm:

      Chrome add extension button

      Chrome will install the extension, and a success message and a new icon will appear in the upper right corner of your browser next to the address bar:

      Chrome success message

      If the icon does not appear, you can add it by clicking on the puzzle piece, then clicking on the pushpin icon by the React Developer Tools:

      Pin extension

      When you are on a page that does not have any React components, the icon will appear gray. However, if you are on a page with React components, the icon will appear blue and green. If you click on the icon, it will indicate that the application is running a production version of React.

      Visit digitalocean.com, to find that the homepage is running a production version of React:

      DigitalOcean React Production Build information

      Now that you are on a website that uses React, open the console to access the React Developer Tools. Open the console by either right-clicking and inspecting an element or by opening the toolbar by clicking View > Developer > JavaScript console.

      When you open the console, you’ll find two new tabs: Components and Profiler:

      Console Open

      The Components tab will show the current React component tree, along with any props, state, or context. The Profiler tab lets you record interactions and measure component rendering. You’ll explore the Profiler tab in Step 3.

      Click on the Components tab to see the current component tree.

      Since this is a production build, the code will be minified and the components will not have descriptive names:

      Components for digitalocean.com in the console

      Now that you’ve tried out React Developer Tools on a working website, you can use it on your test application. If you haven’t started your debug-tutorial application yet, go to a terminal window and run npm start from the root of the project.

      Open a browser to http://localhost:3000.

      Notice that the icon for React Developer Tools is now red and white. If you click on the React Developer Tools icon, you’ll see a warning that the page is in development mode. Since you are still working on the sample application, this is expected.

      Open the console and you’ll find the name of the App component in the Components tab.

      Base Component

      There’s not a lot of information yet, but as you build out the project in the next step, you’ll see all of your components forming a navigable tree.

      In this step, you added the React Developer Tools extension to Chrome. You activated the tools on both a production and a development page, and you briefly explored your debug-tutorial project in the Components tab. In the next step, you’ll build the text analyzer that you’ll use to try out the features of the React Developer Tools.

      Step 2 — Identifying Real-Time Component Props and Context

      In this step, you’ll build a small application to analyze a block of text. The app will determine and report the word count, character count, and character frequency of the text in the input field. As you build the application, you’ll use React Developer Tools to explore the current state and props of each component. You’ll also use React Developer Tools to view the current context in deeply nested components. Finally, you’ll use the tools to identify components that re-render as state changes.

      By the end of this step, you’ll be able to use the React Developer Tools to explore a live application and to observe the current props and state without console statements or debuggers.

      To start, you will create an input component that will take a large amount of text.

      Open the App.js file:

      • nano src/components/App/App.js

      Inside the component, add a div with a class of wrapper, then create a <label> element surrounding a <textarea> element:

      debug-tutorial/src/components/App/App.js

      import React from 'react';
      import './App.css';
      
      function App() {
        return(
          <div className="wrapper">
           <label htmlFor="text">
             Add Your Text Here:
             <br>
             <textarea
               id="text"
               name="text"
               rows="10"
               cols="100"
             >
             </textarea>
            </label>
          </div>
        )
      }
      
      export default App;
      

      This will be the input area for your user. The htmlFor attribute links the label element to elements with an id of text using JSX. You also give the <textarea> component 10 rows and 100 columns to provide room for a large amount of text.

      Save and close the file. Next, open App.css:

      • nano src/components/App/App.css

      Add some styling to the application by replacing the contents with the following:

      debug-tutorial/src/components/App.App.css

      .wrapper {
          padding: 20px;
      }
      
      .wrapper button {
          background: none;
          border: black solid 1px;
          cursor: pointer;
          margin-right: 10px;
      }
      
      .wrapper div {
          margin: 20px 0;
      }
      

      Here you add some padding to the wrapper class, then simplify child <button> elements by removing the background color and adding some margin. Finally, you add a small margin to child <div> elements. These styles will apply to components you will build to display information about the text.

      Save the file. When you do, the browser will refresh and you’ll see the input:

      Text area

      Open App.js:

      • nano src/components/App/App.js

      Next, create a context to hold the value from the <textarea> element. Capture the data using the useState Hook:

      debug-tutorial/src/components/App/App.js

      import React, { createContext, useState } from 'react';
      import './App.css';
      
      export const TextContext = createContext();
      
      function App() {
        const [text, setText] = useState('');
      
        return(
          <TextContext.Provider value={text}>
            <div className="wrapper">
              <label htmlFor="text">
                Add Your Text Here:
                <br>
                <textarea
                  id="text"
                  name="text"
                  rows="10"
                  cols="100"
                  onChange={e => setText(e.target.value)}
                >
                </textarea>
              </label>
            </div>
          </TextContext.Provider>
        )
      }
      
      export default App;
      

      Be sure to export TextContext, then wrap the whole component with the TextContext.Provider. Capture the data by adding an onChange prop to your <textarea> element.

      Save the file. The browser will reload. Be sure that you have React Developer Tools open and notice that App component now shows theContext.Provider as a child component.

      Component context in React Developer Tools

      The component by default has a generic name—Context—but you can change that by adding a displayName property to the generated context. Inside App.js, add a line where you set the displayName to TextContext:

      debug-tutorial/src/components/App/App.js

      import React, { createContext, useState } from 'react';
      import './App.css';
      
      export const TextContext = createContext();
      TextContext.displayName="TextContext";
      
      function App() {
          ...
      }
      
      export default App;
      

      It is not necessary to add a displayName, but it does help to navigate components when analyzing the component tree in the console. You will also see the value of the useState Hook in the side bar. Type some text in the input and you’ll see the updated value in React Developer Tools under the hooks section on the App component.

      Update Value in Developer Tools

      The Hook also has a generic name of State, but this is not as easy to update as the context. There is a useDebugValue Hook, but it only works on custom Hooks and is not recommended for all custom Hooks.

      In this case, the state for the App component is the prop to TextContext.Provider. Click on the TextContext.Provider in the React Developer Tools and you’ll see that the value also reflects the input value that you set with the state:

      Updated value for the context

      React Developer Tools is showing you real time prop and context information, and the value will grow as you add components.

      Next, add a component called TextInformation. This component will be a container for the components with specific data analysis, such as the word count.

      First, make the directory:

      • mkdir src/components/TextInformation

      Then open TextInformation.js in your text editor.

      • nano src/components/TextInformation/TextInformation.js

      Inside the component, you will have three separate components: CharacterCount, WordCount, and CharacterMap. You’ll make these components in just a moment.

      The TextInformation component will use the useReducer Hook to toggle the display of each component. Create a reducer function that toggles the display value of each component and a button to toggle each component with an onClick action:

      debug-tutorial/src/components/TextInformation/TextInformation.js

      import React, { useReducer } from 'react';
      
      const reducer = (state, action) => {
        return {
          ...state,
          [action]: !state[action]
        }
      }
      export default function TextInformation() {
        const [tabs, toggleTabs] = useReducer(reducer, {
          characterCount: true,
          wordCount: true,
          characterMap: true
        });
      
        return(
          <div>
            <button onClick={() => toggleTabs('characterCount')}>Character Count</button>
            <button onClick={() => toggleTabs('wordCount')}>Word Count</button>
            <button onClick={() => toggleTabs('characterMap')}>Character Map</button>
          </div>
        )
      }
      

      Notice that your useReducer Hook starts with an object that maps each key to a boolean. The reducer function uses the spread operator to preserve the previous value while setting a new value using the action parameter.

      Save and close the file. Then open App.js:

      • nano src/components/App/App.js

      Add in your new component:

      debug-tutorial/src/components/App/App.js

      import React, { createContext, useState } from 'react';
      import './App.css';
      import TextInformation from '../TextInformation/TextInformation';
      
      ...
      
      function App() {
        const [text, setText] = useState('');
      
        return(
          <TextContext.Provider value={text}>
            <div className="wrapper">
              <label htmlFor="text">
                Add Your Text Here:
                <br>
                <textarea
                  id="text"
                  name="text"
                  rows="10"
                  cols="100"
                  onChange={e => setText(e.target.value)}
                >
                </textarea>
              </label>
              <TextInformation />
            </div>
          </TextContext.Provider>
        )
      }
      
      export default App;
      

      Save and close the file. When you do, the browser will reload, and you’ll see the updated component. If you click on TextInformation in React Developer Tools, you’ll see the value update on each button click:

      Update Reducer on Click

      Now that you have the container component, you’ll need to create each informational component. Each component will take a prop called show. If show is falsy, the component will return null. The components will consume the TextContext, analyze the data, and display the result.

      To start, create the CharacterCount component.

      First, make a new directory:

      • mkdir src/components/CharacterCount

      Then, open CharacterCount.js in your text editor:

      • nano src/components/CharacterCount/CharacterCount.js

      Inside the component, create a function that uses the show prop and displays null if show is falsy:

      debug-tutorial/src/components/CharacterCount/CharacterCount.js

      import React, { useContext } from 'react';
      import PropTypes from 'prop-types';
      import { TextContext } from '../App/App';
      
      export default function CharacterCount({ show }) {
        const text = useContext(TextContext);
      
        if(!show) {
          return null;
        }
      
        return(
          <div>
            Character Count: {text.length}
          </div>
        )
      }
      
      CharacterCount.proTypes = {
        show: PropTypes.bool.isRequired
      }
      

      Inside the CharacterCount function, you assign the value of TextContext to a variable using the useContext Hook. You then return a <div> that shows the character count using the length method. Finally, PropTypes adds a weak typing system to provide some enforcement to make sure the wrong prop type is not passed.

      Save and close the file. Open TextInformation.js:

      • nano src/components/TextInformation/TextInformation.js

      Import CharacterCount and add the component after the buttons, passing tabs.characterCount as the show prop:

      debug-tutorial/src/components/TextInformation/TextInformation.js

      import React, { useReducer } from 'react';
      import CharacterCount from '../CharacterCount/CharacterCount';
      
      const reducer = (state, action) => {
        return {
          ...state,
          [action]: !state[action]
        }
      }
      
      export default function TextInformation() {
        const [tabs, toggleTabs] = useReducer(reducer, {
          characterCount: true,
          wordCount: true,
          characterMap: true
        });
      
        return(
          <div>
            <button onClick={() => toggleTabs('characterCount')}>Character Count</button>
            <button onClick={() => toggleTabs('wordCount')}>Word Count</button>
            <button onClick={() => toggleTabs('characterMap')}>Character Map</button>
            <CharacterCount show={tabs.characterCount} />
          </div>
        )
      }
      

      Save the file. The browser will reload and you’ll see the component in the React Developer Tools. Notice that as you add words in the input, the context will update. If you toggle the component, you’ll see the props update after each click:

      Adding text and toggling

      You can also manually add or change a prop by clicking on the property and updating the value:

      Manually Changing Props

      Next, add a WordCount component.

      Create the directory:

      • mkdir src/components/WordCount

      Open the file in a text editor:

      • nano src/components/WordCount/WordCount.js

      Make a component that is similar to CharacterCount, but use the split method on spaces to create an array of words before showing the length:

      debug-tutorial/src/components/WordCount/WordCount.js

      import React, { useContext } from 'react';
      import PropTypes from 'prop-types';
      import { TextContext } from '../App/App';
      
      export default function WordCount({ show }) {
        const text = useContext(TextContext);
      
        if(!show) {
          return null;
        }
      
        return(
          <div>
            Word Count: {text.split(' ').length}
          </div>
        )
      }
      
      WordCount.proTypes = {
        show: PropTypes.bool.isRequired
      }
      

      Save and close the file.

      Finally, create a CharacterMap component. This component will show how often a specific character is used in a block of text. It will then sort the characters by frequency in the passage and display the results.

      First, make the directory:

      • mkdir src/components/CharacterMap

      Next, open CharacterMap.js in a text editor:

      • nano src/components/CharacterMap/CharacterMap.js

      Import and use the TextContext component and use the show prop to display results as you did in the previous components:

      debug-tutorial/src/components/CharacterMap/CharacterMap.js

      import React, { useContext } from 'react';
      import PropTypes from 'prop-types';
      import { TextContext } from '../App/App';
      
      export default function CharacterMap({ show }) {
        const text = useContext(TextContext);
      
        if(!show) {
          return null;
        }
      
        return(
          <div>
            Character Map: {text.length}
          </div>
        )
      }
      
      CharacterMap.proTypes = {
        show: PropTypes.bool.isRequired
      }
      

      This component will need a slightly more complicated function to create the frequency map for each letter. You’ll need to go through each character and increment a value anytime there is a repeat. Then you’ll need to take that data and sort it so that the most frequent letters are at the top of the list.

      To do this, add the following highlighted code:

      debug-tutorial/src/components/CharacterMap/CharacterMap.js

      
      import React, { useContext } from 'react';
      import PropTypes from 'prop-types';
      import { TextContext } from '../App/App';
      
      function itemize(text){
       const letters = text.split('')
         .filter(l => l !== ' ')
         .reduce((collection, item) => {
           const letter = item.toLowerCase();
           return {
             ...collection,
             [letter]: (collection[letter] || 0) + 1
           }
         }, {})
       return Object.entries(letters)
         .sort((a, b) => b[1] - a[1]);
      }
      
      export default function CharacterMap({ show }) {
        const text = useContext(TextContext);
      
        if(!show) {
          return null;
        }
      
        return(
          <div>
           Character Map:
           {itemize(text).map(character => (
             <div key={character[0]}>
               {character[0]}: {character[1]}
             </div>
           ))}
          </div>
        )
      }
      
      CharacterMap.proTypes = {
        show: PropTypes.bool.isRequired
      }
      

      In this code, you create a function called itemize that splits the text into an array of characters using the split() string method. Then you reduce the array to an object by adding the character and then incrementing the count for each subsequent character. Finally, you convert the object to an array of pairs using Object.entries and sort to put the most used characters at the top.

      After you create the function, you pass the text to the function in the render method and map over the results to display the character—array value [0]—and the count—array value [1]—inside a <div>.

      Save and close the file. This function will give you an opportunity to explore some performance features of the React Developer Tools in the next section.

      Next, add the new components to TextInformation and look at the values in React Developer Tools.

      Open TextInformation.js:

      • nano src/components/TextInformation/TextInformation.js

      Import and render the new components:

      debug-tutorial/src/components/TextInformation/TextInformation.js

      import React, { useReducer } from 'react';
      import CharacterCount from '../CharacterCount/CharacterCount';
      import CharacterMap from '../CharacterMap/CharacterMap';
      import WordCount from '../WordCount/WordCount';
      
      const reducer = (state, action) => {
        return {
          ...state,
          [action]: !state[action]
        }
      }
      
      export default function TextInformation() {
        const [tabs, toggleTabs] = useReducer(reducer, {
          characterCount: true,
          wordCount: true,
          characterMap: true
        });
      
        return(
          <div>
            <button onClick={() => toggleTabs('characterCount')}>Character Count</button>
            <button onClick={() => toggleTabs('wordCount')}>Word Count</button>
            <button onClick={() => toggleTabs('characterMap')}>Character Map</button>
            <CharacterCount show={tabs.characterCount} />
            <WordCount show={tabs.wordCount} />
            <CharacterMap show={tabs.characterMap} />
          </div>
        )
      }
      

      Save and close the file. When you do, the browser will refresh, and if you add in some data, you’ll find the character frequency analysis in the new components:

      CharacterMap Component in React Developer Tools

      In this section, you used React Developer Tools to explore the component tree. You also learned how to see the real-time props for each component and how to manually change the props using the developer tools. Finally, you viewed the context for the component change with input.

      In the next section, you’ll use the React Developer Tools Profiler tab to identify components that have long render times.

      Step 3 — Tracking Component Rendering Across Interactions

      In this step, you’ll use the React Developer Tools profiler to track component rendering and re-rendering as you use the sample application. You’ll navigate flamegraphs, or visualizations of your app’s relevant optimization metrics, and use the information to identify inefficient components, reduce rendering time, and increase application speed.

      By the end of this step, you’ll know how to identify components that render during user interactions and how to compose components to reduce inefficient rendering.

      A quick way to see how components change each other is to enable highlighting when a component is re-rendered. This will give you a visual overview of how the components respond to changing data.

      In React Developer Tools, click on the Settings icon. It will look like a gear:

      Settings icon

      Then select the option under General that says Highlight updates when components render.

      Highlight changes

      When you make any changes, React Developer Tools will highlight components that re-render. For example, when you change input, every component re-renders because the data is stored on a Hook at the root level and every change will re-render the whole component tree.

      Notice the highlighting around the components, including the top of the screen around the root component:

      Highlighting Text

      Compare that to how the components re-render when you click on one of the buttons to toggle the data. If you click one of the buttons, the components under TextInformation will re-render, but not the root component:

      Rerendering lower components only

      Showing the re-renders will give you a quick idea of how the components are related, but it doesn’t give you a lot of data to analyze specific components. To gain more insight, let’s look at the profiler tools.

      The profiler tools are designed to help you measure precisely how long each component takes to render. This can help you identify components that may be slow or process intense.

      Re-open the settings and uncheck the box for Highlight updates when components render. Then click on the Profiler tab in the console.

      To use the profiler, click the blue circle on the left of the screen to begin recording and click it again when you are finished:

      Start profiling

      When you stop recording, you’ll find a graph of the component changes including, how long each item took to render.

      To get a good sense of the relative efficiency of the components, paste in the Wikipedia page for Creative Commons. This text is long enough to give interesting results, but not so big that it will crash the application.

      After pasting in the text, start the profiler, then make a small change to the input. Stop profiling after the component has finished re-rendering. There will be a long pause, because the application is handling a long re-rendering:

      Adding a change with a lot of text

      When you end the recording, React Developer Tools will create a flamegraph that shows every component that re-rendered and how long it took to re-render each component.

      In this case, every keypress from the word “Change” causes a re-render. More importantly, it shows how long each render takes and why there was a long delay. The components App, TextContext.Provider, and TextInformation take about .2 milliseconds to rerender. But the CharacterMap component takes around 1 second per keystroke to re-render because of the complicated data parsing in the itemize function.

      In the display, each yellow bar is a new keystroke. You can replay the sequence one at a time by clicking on each bar. Notice that there is slight variation in the render times, but the CharacterMap is consistently slow:

      Looking at the flamegraph

      You can get more information by selecting the option Record why each component rendered while profiling. under the Profiler section of the settings.

      Try toggling the Word Count component and notice how long the changes take. The application still lags even though you haven’t changed the text content:

      Word Count toggle flamegraph

      Now when you hover your cursor over a component, you’ll find that it includes a reason the component re-rendered. In this case, the reason the component changed is The parent component rendered. That’s a problem for the CharacterMap component. CharacterMap is doing an expensive calculation every time the parent changes, even if the props and the context do not change. That is, it’s recalculating data even though the data is identical to the previous render.

      Click on the Ranked tab and you’ll find how much more time CharacterMap takes when compared to all other components:

      Ranked Tab

      React Developer Tools have helped isolate a problem: the CharacterMap component re-renders and performs an expensive calculation anytime any parent component changes.

      There are multiple ways to solve the problem, but they all involve some sort of caching via memoization, a process by which already calculated data is remembered rather than recalculated. You can either use a library like lodash/memoize or memoize-one to cache the results of the itemize function, or you can use the built in React memo function to memoize the whole component.

      If you use the React memo, the function will only re-render if the props or context change. In this case, you’ll use React memo. In general, you should memoize the data itself first since it’s a more isolated case, but there are some interesting changes in the React Developer Tools if you memoize the whole component, so you’ll use that approach in this tutorial.

      Open CharacterMap.js:

      • nano src/components/CharacterMap/CharacterMap.js

      Import memo from React, then pass the entire function into the memo function:

      debug-tutorial/src/components/CharacterMap/CharacterMap.js

      import React, { memo, useContext } from 'react';
      import PropTypes from 'prop-types';
      import { TextContext } from '../App/App';
      
      ...
      
      function CharacterMap({ show }) {
        const text = useContext(TextContext);
      
        if(!show) {
          return null;
        }
      
        return(
          <div>
           Character Map:
           {itemize(text).map(character => (
             <div key={character[0]}>
               {character[0]}: {character[1]}
             </div>
           ))}
          </div>
        )
      }
      
      CharacterMap.proTypes = {
        show: PropTypes.bool.isRequired
      }
      
      export default memo(CharacterMap);
      
      

      You move the export default line to the end of the code in order to pass the component to memo right before exporting. After that, React will compare the props before re-rendering.

      Save and close the file. The browser will reload, and when you toggle the WordCount, the component will update much faster. This time, CharacterMap does not re-render. Instead, in React Developer Tools, you’ll see a gray rectangle showing re-rendering was prevented.

      React Developer Tools showing that CharacterMap did not re-render

      If you look at the Ranked tab, you’ll find that both the CharacterCount and the WordCount re-rendered, but for different reasons. Since CharacterCount is not memoized, it re-rendered because the parent changed. The WordCount re-rendered because the props changed. Even if it was wrapped in memo, it would still rerender.

      Ranked view of memoized app

      Note: Memoizing is helpful, but you should only use it when you have a clear performance problem, as you did in this case. Otherwise, it can create a performance problem: React will have to check props every time it re-renders, which can cause a delay on smaller components.

      In this step, you used the profiler to identify re-renders and componenent re-rendering. You also used flamegraphs and ranked graphs to identify components that are slow to re-render and then used the memo function to prevent re-rendering when there are no changes to the props or context.

      Conclusion

      The React Developer Tools browser extension gives you a powerful set of utilities to explore your components in their applications. With these tools, you’ll be able to explore a component’s state and identify bugs using real data without console statements or debuggers. You can also use the profiler to explore how components interact with each other, allowing you to identify and optimize components that have slow rendering in your full application. These tools are a crucial part of the development process and give you an opportunity to explore the components as part of an application and not just as static code.

      If you would like to learn more about debugging JavaScript, see our article on How To Debug Node.js with the Built-In Debugger and Chrome DevTools. For more React tutorials, check out our React Topic page, or return to the How To Code in React.js series page.



      Source link