Close Menu
Soshace Digital Blog

    Subscribe to Updates

    Get The Latest News, Updates, And Amazing Offers

    What's Hot
    JavaScript

    Error Handling in JavaScript: A Guide to Try/Catch, Throw, and Custom Error Classes

    SaaS & Tech

    Navigating Tomorrow: Innovations Shaping the Future of SaaS

    Interview

    Interview with Alex

    Important Pages:
    • Home
    • About
    • Services
    • Contact Us
    • Privacy Policy
    • Terms & Conditions
    Facebook X (Twitter) Instagram LinkedIn YouTube
    Today's Picks:
    • Scaling Success: Monitoring Indexation of Programmatic SEO Content
    • Leveraging Influencers: Key Drivers in New Product Launches
    • How Privacy-First Marketing Will Transform the Industry Landscape
    • The Impact of Social Proof on Thought Leadership Marketing
    • Balancing Value-Driven Content and Promotional Messaging Strategies
    • Top Influencer Marketing Platforms to Explore in 2025
    • Emerging Trends in Marketing Automation and AI Tools for 2023
    • Strategies to Mitigate Duplicate Content in Programmatic SEO
    Wednesday, November 12
    Facebook X (Twitter) Instagram LinkedIn YouTube
    Soshace Digital Blog
    • Home
    • About
    • Services
    • Contact Us
    • Privacy Policy
    • Terms & Conditions
    Services
    • SaaS & Tech

      Maximizing Efficiency: How SaaS Lowers IT Infrastructure Costs

      August 27, 2025

      Navigating Tomorrow: Innovations Shaping the Future of SaaS

      August 27, 2025

      Maximizing Impact: Strategies for SaaS & Technology Marketing

      August 27, 2025
    • AI & Automation

      Enhancing Customer Feedback Analysis Through AI Innovations

      August 27, 2025

      Navigating the Impact of AI on SEO and Search Rankings

      August 27, 2025

      5 Automation Hacks Every Home Service Business Needs to Know

      May 3, 2025
    • Finance & Fintech

      Critical Missteps in Finance Marketing: What to Avoid

      August 27, 2025

      Analyzing Future Fintech Marketing Trends: Insights Ahead

      August 27, 2025

      Navigating the Complex Landscape of Finance and Fintech Marketing

      August 27, 2025
    • Legal & Compliance

      Exploring Thought Leadership’s Impact on Legal Marketing

      August 27, 2025

      Maximizing LinkedIn: Strategies for Legal and Compliance Marketing

      August 27, 2025

      Why Transparency Matters in Legal Advertising Practices

      August 27, 2025
    • Medical Marketing

      Enhancing Online Reputation Management in Hospitals: A Guide

      August 27, 2025

      Analyzing Emerging Trends in Health and Medical Marketing

      August 27, 2025

      Exploring Innovative Content Ideas for Wellness Blogs and Clinics

      August 27, 2025
    • E-commerce & Retail

      Strategic Seasonal Campaign Concepts for Online and Retail Markets

      August 27, 2025

      Emerging Trends in E-commerce and Retail Marketing Strategies

      August 27, 2025

      Maximizing Revenue: The Advantages of Affiliate Marketing for E-Commerce

      August 27, 2025
    • Influencer & Community

      Leveraging Influencers: Key Drivers in New Product Launches

      August 27, 2025

      Top Influencer Marketing Platforms to Explore in 2025

      August 27, 2025

      Key Strategies for Successful Influencer Partnership Negotiations

      August 27, 2025
    • Content & Leadership

      The Impact of Social Proof on Thought Leadership Marketing

      August 27, 2025

      Balancing Value-Driven Content and Promotional Messaging Strategies

      August 27, 2025

      Analyzing Storytelling’s Impact on Content Marketing Effectiveness

      August 27, 2025
    • SEO & Analytics

      Scaling Success: Monitoring Indexation of Programmatic SEO Content

      August 27, 2025

      Strategies to Mitigate Duplicate Content in Programmatic SEO

      August 27, 2025

      Effective Data Visualization Techniques for SEO Reporting

      August 27, 2025
    • Marketing Trends

      How Privacy-First Marketing Will Transform the Industry Landscape

      August 27, 2025

      Emerging Trends in Marketing Automation and AI Tools for 2023

      August 27, 2025

      Maximizing ROI: Key Trends in Paid Social Advertising

      August 27, 2025
    Soshace Digital Blog
    Blog / JavaScript / React / React Lessons / React Lesson 5: React Devtools and Reusable Open-Source Components
    JavaScript

    React Lesson 5: React Devtools and Reusable Open-Source Components

    Mohammad Shad MirzaBy Mohammad Shad MirzaDecember 20, 2019Updated:February 9, 2020No Comments4 Mins Read
    Facebook Twitter Pinterest Telegram LinkedIn Tumblr Email Reddit
    React Lesson 5: React Devtools and Reusable Open-Source Components
    Share
    Facebook Twitter LinkedIn Pinterest Email Copy Link

    React Developer Tools is a Browser Extension that allows you to inspect the React component hierarchy and provide a view of the component tree, the current state & props of each component. It makes debugging easy and developer’s life simple. We will learn how to utilize DevTools in debugging React. Let’s get started.

    Installing DevTools

    DevTools extension can be installed either on Chrome or Firefox. You can visit the link below to install the extension.

    • DevTools for Firefox
    • DevTools for Chrome

    If you can see the React logo next to the address bar then your setup is complete.

    Inspecting our App

    Open React DevTools in your browser by right-clicking and selecting Inspect. “Components” and “Profiler” tabs will appear to the right which we will explore while debugging our app.

    You can browse through the component tree and get a better understanding of the structure of your app. React elements can be selected to view extra information about that component like props, state, etc.

    DevTools helps us understand how a component (example: ArticleList) is receiving data i.e. the complete downward data flow from root to children. We can manipulate the data a component is receiving in real-time and see how it changes the Virtual DOM. This is really powerful when it comes to debugging.

    React approaches building user interfaces differently by breaking them into components. It encourages us to re-use components wherever possible and more often than not we can find a component of our need from Open-Source. One such component is react-select which we are going to use in this tutorial. But before that, let’s restructure our project:

    • Create a new folder ‘components’ and move all our components there. This folder will contain all the components.
    • Change the imports to point to this directory. (file names are in the comment above)
    // app.js
    import ArticleList from './components/ArticleList';
    
    //ArticleList.js
    import oneOpen from '../decorators/oneOpen';
    
    // ArticleListOld.js
    import oneOpen from '../mixins/oneOpen';
    
    // CommentList.js
    import toggleOpen from '../decorators/toggleOpen';

    Let’s add react-select

    1. Run this command to install the component:

    npm install react-select

    2. Import the component

    import Select from 'react-select';
    

    3. Select component expects an options array props with objects having labels and value property. Look for the documentation when you’re using a component from Open-Source for information like these. We can create this options object as:

    const options = articles.map(article => ({
        label: article.title,
        value: article.id
      }));

    4. Use it inside the ArticleList  component:

    import React, { Component }  from 'react';
    import Article from './Article/index';
    import oneOpen from '../decorators/oneOpen';
    import Select from 'react-select';
    
    class ArticleList extends Component {
      state = { 
        selectedArticles: null, 
      }
        
      handleSelectChange = (selectedArticles) => {
        console.log(selectedArticles);
        this.setState({ selectedArticles });
      }
    
      renderListItem = () => {
        const { articles, isItemOpen, toggleOpenItem } = this.props;
        return articles.map((article) => (
          <li key={article.id}>
            <Article
              article={article}
              isOpen={isItemOpen(article.id)}
              openArticle={toggleOpenItem(article.id)}
            />
          </li>
        ));
      };
    
      render() {
        const { articles } = this.props;
        const options = articles.map((article) => ({
            label: article.title,
            value: article.id
        }));
        return (
          <div>
            <h1>Article list</h1>
            <Select
              options={options}
              isMulti={true}
              value={this.state.selectedArticles}
              onChange={this.handleSelectChange}
            />
            <ul>
              {this.renderListItem()}
            </ul>
          </div>
        );
      }
    }
    
    export default openOpen(ArticleList);

    Here, we are describing the state of our ‘Select’ – null. Add value, onChange. It means when we choose an item in ‘Select’, the object will be transmitted and shown in the console log in the handleSelectChange method.

    Read More:  Minimize Downtime by Creating a Health-check for Your NodeJS Application

    Conclusion

    • Primary advice is to reuse code and components and focus on business logic.
    • We learned how to install and use React Devtools to view your component hierarchy and debug like a pro.
    • We learned how to use a third-party component and the wonderful world of Open-Source.

    We still have a lot of interesting things to do. Stay tuned!
    You can check out the live playground of today’s lesson in the codesandbox below.

    Edit React_lesson_lesson5

    The lessons code can be found in our repository.

    Previous lessons can be viewed here: https://blog.soshace.com/category/javascript/react/react-lessons/

    JavaScript programming react react lessons
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email
    Mohammad Shad Mirza
    • X (Twitter)
    • LinkedIn

    JavaScript lover working on React Native and committed to simplifying code for beginners. Apart from coding and blogging, I like spending my time sketching or writing with a cup of tea.

    Related Posts

    Streamlining Resource Allocation for Enhanced Project Success

    December 18, 2024

    Conducting Effective Post-Project Evaluations: A Guide

    December 16, 2024

    Strategies for Keeping Projects on Track and Meeting Deadlines

    December 10, 2024
    Leave A Reply Cancel Reply

    You must be logged in to post a comment.

    Stay In Touch
    • Facebook
    • Twitter
    • Pinterest
    • Instagram
    • YouTube
    • Vimeo
    Don't Miss
    Beginners December 4, 2019

    List of Coding Games to Practice & Improve Your Programming Skills

    In this post, we’ll take a look at some of the best online games to learn new programming languages and practice your existing programming skills. Some of those are beginner only, others may seem far advanced at the start, but give it a go, and you’ll thank us later. If we forgot to mention something, or you’re building a cool game of your own, do let us know in the comments! Happy learning!

    Уроки React. Урок 1, Введение.

    September 5, 2016

    How to build complex layouts with CSS Grid

    August 28, 2020

    Strategies for Enhancing Customer Retention in Startups

    December 17, 2024

    Categories

    • AI & Automation
    • Angular
    • ASP.NET
    • AWS
    • B2B Leads
    • Beginners
    • Blogs
    • Business Growth
    • Case Studies
    • Comics
    • Consultation
    • Content & Leadership
    • CSS
    • Development
    • Django
    • E-commerce & Retail
    • Entrepreneurs
    • Entrepreneurship
    • Events
    • Express.js
    • Facebook Ads
    • Finance & Fintech
    • Flask
    • Flutter
    • Franchising
    • Funnel Strategy
    • Git
    • GraphQL
    • Home Services Marketing
    • Influencer & Community
    • Interview
    • Java
    • Java Spring
    • JavaScript
    • Job
    • Laravel
    • Lead Generation
    • Legal & Compliance
    • LinkedIn
    • Machine Learning
    • Marketing Trends
    • Medical Marketing
    • MSP Lead Generation
    • MSP Marketing
    • NestJS
    • Next.js
    • Node.js
    • Node.js Lessons
    • Paid Advertising
    • PHP
    • Podcasts
    • POS Tutorial
    • Programming
    • Programming
    • Python
    • React
    • React Lessons
    • React Native
    • React Native Lessons
    • Recruitment
    • Remote Job
    • SaaS & Tech
    • SEO & Analytics
    • Soshace
    • Startups
    • Swarm Intelligence
    • Tips
    • Trends
    • Vue
    • Wiki
    • WordPress
    Top Posts

    Why Startups Fail? Part 1

    Startups October 5, 2016

    Leveraging LinkedIn Recommendations for Effective Prospecting

    LinkedIn December 16, 2024

    Quam Nulla Porttitor Massa Dneque Aliquam Vestibulum

    JavaScript January 28, 2020

    React Lesson 4: Homework. Decorators and Mixins

    JavaScript December 19, 2019

    Subscribe to Updates

    Get The Latest News, Updates, And Amazing Offers

    About Us
    About Us

    Soshace Digital delivers comprehensive web design and development solutions tailored to your business objectives. Your website will be meticulously designed and developed by our team of seasoned professionals, who combine creative expertise with technical excellence to transform your vision into a high-impact, user-centric digital experience that elevates your brand and drives measurable results.

    7901 4th St N, Suite 28690
    Saint Petersburg, FL 33702-4305
    Phone: 1(877)SOSHACE

    Facebook X (Twitter) Instagram Pinterest YouTube LinkedIn
    Our Picks
    LinkedIn

    Leveraging LinkedIn Recommendations for Effective Prospecting

    Content & Leadership

    The Impact of Social Proof on Thought Leadership Marketing

    Beginners

    List of Coding Games to Practice & Improve Your Programming Skills

    Most Popular

    Enhancing B2B Lead Generation with Data and Analytics Strategies

    B2B Leads

    The Ultimate Guide to Using GitHub Pages

    Beginners

    Mastering REST APIs: Essential Techniques for Programmers

    Programming
    © 2025 Soshace Digital.
    • Home
    • About
    • Services
    • Contact Us
    • Privacy Policy
    • Terms & Conditions

    Type above and press Enter to search. Press Esc to cancel.