Close Menu
Soshace Digital Blog

    Subscribe to Updates

    Get The Latest News, Updates, And Amazing Offers

    What's Hot
    Flutter

    How to Add Custom Fonts in Flutter

    Interview

    Interview with Leonid

    Java

    Spring Cloud Config Refresh Strategies

    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, September 10
    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:  React Lesson 11. Pt.2: Redux Middlewares

    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
    Angular January 13, 2020

    How to Upload Images to a Cloud Storage(Imgur) in an Angular Application

    In this article, we’re going to develop a simple Angular application which is used to add and display photos. This application will use Imgur to store images that are added to this application.

    Everyday Coding

    August 9, 2016

    8 Best Blogs for Entrepreneurs: Start Business, Grow Professionally, or Change Your Life

    April 18, 2019

    A/B Testing Explained + a Collection of A/B Testing Learning Resources

    October 17, 2019

    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

    2. Уроки Node.js. Модули Часть 2

    Programming September 6, 2016

    Advanced Node.Js: A Hands on Guide to Event Loop, Child Process and Worker Threads in Node.Js

    JavaScript January 24, 2020

    Enhancing Code Quality: Best Practices for Software Development

    Development November 29, 2024

    How We are Looking for Proposals on UpWork

    Remote Job January 8, 2016

    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
    Programming

    23. Node.js Lessons. Domains, asynchronous try.. catch. Part 2.

    JavaScript

    JAMstack Architecture with Next.js

    Influencer & Community

    Top Influencer Marketing Platforms to Explore in 2025

    Most Popular

    Уроки Express.js . Логгер, Конфигурация, Шаблонизация с EJS. Часть 2.

    Programming

    Comparative Analysis of Free Tools for Physical Memory Dumps Parsing

    JavaScript

    Node.js Lesson 8: Inheritance from Errors, Error

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

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