Close Menu
Soshace Digital Blog

    Subscribe to Updates

    Get The Latest News, Updates, And Amazing Offers

    What's Hot
    Finance & Fintech

    Analyzing Future Fintech Marketing Trends: Insights Ahead

    LinkedIn

    Strategic Methods for Building a LinkedIn Prospect List

    Laravel

    Testing Laravel Applications Like a Pro with PHPUnit

    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
    Sunday, September 28
    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:  Knowledge is a power

    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
    JavaScript February 9, 2020

    React Lesson 8: Deep Dive into React Redux

    Today, we’re going to do more complicated things. We will go away from the manual description of “closure,” subscriptions, and so on. All these things are, of course, not for manual maintenance. We will learn how to do these things easily and gracefully.

    Programming Patterns. Strategy, Observer, Iterator

    February 8, 2017

    “Learn Python the Hard Way”: a Detailed Book Review

    September 17, 2019

    Memory Leaks in Java: A Cautionary Tale and Gentle Introduction to Preventing Memory Errors

    December 26, 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

    Streamlining LinkedIn Lead Generation with Effective CRM Integration

    LinkedIn December 10, 2024

    Implementing Data Privacy Principles in Software Development

    Development December 4, 2024

    Crafting an Effective Marketing Strategy for Your Startup

    Startups December 9, 2024

    JavaScript and React Podcasts: The Ultimate Guide to Web Development Podcasts — Part 1

    Podcasts April 9, 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
    Entrepreneurship

    Essential Steps to Craft a Winning Startup Business Model

    Influencer & Community

    Leveraging Influencers: Key Drivers in New Product Launches

    Programming

    3. Уроки Express.js. Шаблонизация с EJS: Layout, Block, Partials

    Most Popular

    Strategic LinkedIn Techniques for Real Estate Lead Generation

    LinkedIn

    Effective Strategies for Managing Project Risks Successfully

    JavaScript

    Crafting Compelling Job Descriptions for Successful Recruitment

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

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