Refactoring React Component Hierarchies to Eliminate Prop Drilling

arXiv:2610.01376 · cs.SE · Submitted 2026-10-01 · Read on arXiv

Listen

Radio episode about this paper

Transcript

Introduction to the show: ident: Computer Science. The day in computer science: software, systems and theory on arXiv.

Tom: We're looking at the paper: "Refactoring React Component Hierarchies to Eliminate Prop Drilling".

Jane: Here's the gist of the paper. In this work, we propose a static analysis method for identifying Prop Drilling instances in a React codebase and eliminating them using two automated refactoring strategies based on Context API and Component Composition, native React capabilities that facilitate the implementation of adaptable and reusable components The main findings of the empirical evaluation indicate (a) the frequent occurrence of prop drillings across benchmark projects, irrespective of project size (b) their generally low to moderate complexity in terms of data propagation depth, contrasted with the more prevalent complexity arising from the simultaneous forwarding of multiple properties along the same path and (c) the potential for automated elimination of a substantial share (76.3%) of prop drillings, primarily through refactoring to the Context API.

Tom: Prop Drilling Definition and Complexity Metrics The paper formally defines Prop Drilling based on Prop Passing and Prop Forwarding, where a sequence of prop passings constitutes a Prop Drilling from a source component to a target component The impact of Prop Drilling on code maintainability is affected by the number of intermediate components in Prop Drilling instances, which is assessed using the depth metric equal to the number of intermediates or equivalently to the number of prop forwardings in the prop drilling sequence Furthermore, Compound Prop Drilling (CPD) is defined by considering multiple properties simultaneously forwarded along the same path, where the cardinality of the property set J will be referred to as breadth of CP Ds,t,J.

Jane: Identification Method The identification of Prop Drilling instances is based on a graph representation of the React codebase called the Component Hierarchy Graph (CHG), which statically approximates parent-child relationships and data flow due to prop passings and prop forwardings This CHG construction involves static analysis of all production JS/TS files, where components are identified by analyzing the Abstract Syntax Tree (AST) representation of each source file The set of edges E in the CHG represents parent-child dependencies, and each edge is represented as a tuple (ca, cb, P Pa,b, P Fa,b), where P Pa,b and P Fa,b represent the sets of prop passings and prop forwardings from ca to cb respectively.

Tom: Prop Drilling instances are then identified through CHG traversal following sequences of compatible prop forwardings along successive edges to construct Prop Drilling instances Refactoring Strategies and Preconditions The paper specifies source code transformation procedures for eliminating a Prop Drilling instance through either refactoring strategy, namely Component Composition or the Context API The applicability of the Component Composition strategy is evaluated against a set of refactoring preconditions (RP1 to RP5), ensuring that the refactoring does not introduce syntax errors or alter external behavior If these are violated, the Context API strategy is evaluated against a separate set of preconditions (RP6 and RP7) For instance, RP5 states that given any intermediate component Ci in the prop drilling path, it should not declare and use in its implementation the predefined children property.

Paper summary: Jane: So to wrap up, the authors of "Refactoring React Component Hierarchies to Eliminate Prop Drilling" have put forward a method that uses a Component Hierarchy Graph and static analysis to find prop drilling instances.

Tom: They suggest two main refactoring paths—using the Context API or Component Composition—and their empirical results showed that these automated strategies can eliminate about seventy-six point three percent of all prop drillings identified in their benchmark projects <ref:2610.01376#pg1>.

Lu: The core idea they are pushing is that by understanding the depth and breadth metrics of data propagation, developers can use native React features to create more adaptable and reusable components <ref:2610.01376#pg3>.

Meng: What this means for us at the startup side is that we have a way to quantify the coupling introduced by prop drilling, which could be useful when deciding whether to refactor a specific piece of code or just leave it alone.

Lalam: And they also pointed out that while the method is powerful, its main limitation is that it relies on static analysis of the Abstract Syntax Tree, meaning it might not catch every dynamic data flow scenario <ref:2610.01376#pg3>.

Jane: So essentially, this paper provides a concrete framework for identifying and automating fixes for prop drilling in React codebases based on structural analysis and measurable complexity metrics <ref:2610.01376#pg1>.

Conclusion: Tom: So, to wrap up, this paper proposes a static analysis method to find prop drilling in React code and two refactoring strategies—Context API and Component Composition—to fix it <ref:2610.01376#pg1>.

Jane: It boils down to taking all that messy data passing between components, mapping it out on a graph, and then using those maps to automatically clean up the code by either moving data into the Context API or restructuring how components talk to each other <ref:2610.01376#pg4>.

Lu: The authors found that prop drilling is super common across different React projects, regardless of how big those projects are, and they also measured the complexity—they looked at depth and breadth—and it turns out compound prop drilling is actually way more frequent than just simple deep drilling <ref:2610.01376#pg2> to show up in the data flow.

Meng: So, when you look at the results, they found that this automated cleanup strategy can fix about seventy-six point three percent of all prop drillings they found across their benchmark projects <ref:2610.01376#pg2> which is a pretty solid number for a tool to handle automatically.

Tom: It shows the potential for this kind of analysis, but I'm looking at the authors themselves, Vangelis Gkinisa and Vassilis E. Zafeirisb <ref:2610.01376#pg2>. They are from Athens University of Economics and Business and Computer Science in Greece, right?

Jane: Yeah, they’ve got this method called ReactRefactor that lets you pick the refactoring strategy through an interactive command line menu <ref:2610.01376#pg1>, which is pretty cool because it gives you control over how you fix things.

Lu: What's interesting is they tested two different paths for refactoring—the Component Composition one and the Context API one—and they found that the Context API strategy could fix seventy-four point nine percent of all identified prop drillings <ref:2610.01376#pg2>.

Meng: That’s a big win for maintainability if you have to deal with hundreds of components; it means you can automate the bulk of the cleanup without manually hunting down every single data path <ref:2610.01376#pg2>.

Tom: It really suggests that using native React features like Context and Composition is a viable way to keep data flow organized, instead of just letting it become this tangled web <ref:2610.01376#pg3>.

Jane: And while they show what works with their benchmarks, I have to remember that static analysis can only see what’s written in the code right now, so it might miss some tricky dynamic data flows <ref:2610.01376#pg3>.

Lu: Exactly. Their method relies on building a Component Hierarchy Graph, which is a static approximation of how things are connected based on prop passings and forwardings <ref:2610.01376#pg4>, but it’s still just an approximation of the real-time behavior.

Meng: For us deploying models, that means this isn't a perfect safety net for runtime issues; you still need robust testing to catch what the static analyzer misses <ref:2610.01376#pg2>.

Tom: Anyway, it’s clear that by measuring depth and breadth, we can quantify the coupling introduced by prop drilling and use those numbers to make informed decisions about refactoring in our React apps.

Department of Informatics, Athens University of Economics and Business · Computer Science and Engineering Department, University of Ioannina

cs.SE

Submitted: 2026-10-01

Updated: 2026-11-05

Comments: Submitted for review to Elsevier Journal

Code: https://github.com/AlDanial/cloc2https:

License: http://creativecommons.org/licenses/by-nc-nd/4.0/

Importance score: 73/100

The gist: In this work, we propose a static analysis method for identifying Prop Drilling instances in a React codebase and eliminating them using two automated refactoring strategies based on Context API and…

Key concepts

Prop Drilling
This occurs when data needs to travel through many intermediate components in a React hierarchy just to reach a component that actually needs it. It's done by passing props down through successive components, which makes tracing the data flow difficult and harms maintainability.
Prop Drilling Depth
This metric measures how many intermediate components are involved in a single prop drilling sequence. A higher depth means more unnecessary coupling between the source and target components, indicating greater complexity in the data propagation path.
Compound Prop Drilling (CPD)
CPD refers to situations where multiple properties are simultaneously forwarded along the exact same path of intermediate components. This increases coupling because changes to any one property might require updating many other properties at that same depth.
Component Hierarchy Graph (CHG)
This is a static graph representation of the React codebase that maps parent-child relationships and data flow based on prop passings and forwardings. It allows the method to mathematically model the structure of data propagation across different components.

Terminology

Summary

In this work, we propose a static analysis method for identifying Prop Drilling instances in a React codebase and eliminating them using two automated refactoring strategies based on Context API and Component Composition, native React capabilities that facilitate the implementation of adaptable and reusable components The main findings of the empirical evaluation indicate (a) the frequent occurrence of prop drillings across benchmark projects, irrespective of project size (b) their generally low to moderate complexity in terms of data propagation depth, contrasted with the more prevalent complexity arising from the simultaneous forwarding of multiple properties along the same path and (c) the potential for automated elimination of a substantial share (76. p. 0

Where the paper says it

The main findings of the empirical evaluation indicate (a) the frequent occurrence of prop drillings across benchmark projects, irrespective of project size; (b) their generally low to moderate complexity in terms of data propagation depth, contrasted with the more prevalent complexity arising from the simultaneous forwarding of multiple properties along the same path; and, (c) the potential for automated elimination of a substantial share (76. 3%) of prop drillings, primarily through refactoring to the Context API.

3%) of prop drillings, primarily through refactoring to the Context API. p. 0
Where the paper says it

The main findings of the empirical evaluation indicate (a) the frequent occurrence of prop drillings across benchmark projects, irrespective of project size; (b) their generally low to moderate complexity in terms of data propagation depth, contrasted with the more prevalent complexity arising from the simultaneous forwarding of multiple properties along the same path; and, (c) the potential for automated elimination of a substantial share (76. 3%) of prop drillings, primarily through refactoring to the Context API.

Prop Drilling Definition and Complexity Metrics

The paper formally defines Prop Drilling based on Prop Passing and Prop Forwarding, where a sequence of prop passings constitutes a Prop Drilling from a source component to a target component The impact of Prop Drilling on code maintainability is affected by the number of intermediate components in Prop Drilling instances, which is assessed using the depth metric equal to the number of intermediates or equivalently to the number of prop forwardings in the prop drilling sequence Furthermore, Compound Prop Drilling (CPD) is defined by considering multiple properties simultaneously forwarded along the same path, where the cardinality of the property set J will be referred to as breadth of CP Ds,t,J.

Identification Method

The identification of Prop Drilling instances is based on a graph representation of the React codebase called the Component Hierarchy Graph (CHG), which statically approximates parent-child relationships and data flow due to prop passings and prop forwardings This CHG construction involves static analysis of all production JS/TS files, where components are identified by analyzing the Abstract Syntax Tree (AST) representation of each source file The set of edges E in the CHG represents parent-child dependencies, and each edge is represented as a tuple (ca, cb, P Pa,b, P Fa,b), where P Pa,b and P Fa,b represent the sets of prop passings and prop forwardings from ca to cb respectively. Prop Drilling instances are then identified through CHG traversal following sequences of compatible prop forwardings along successive edges to construct Prop Drilling instances

Refactoring Strategies and Preconditions

The paper specifies source code transformation procedures for eliminating a Prop Drilling instance through either refactoring strategy, namely Component Composition or the Context API The applicability of the Component Composition strategy is evaluated against a set of refactoring preconditions (RP1 to RP5), ensuring that the refactoring does not introduce syntax errors or alter external behavior If these are violated, the Context API strategy is evaluated against a separate set of preconditions (RP6 and RP7) For instance, RP5 states that given any intermediate component Ci in the prop drilling path, it should not declare and use in its implementation the predefined children property.

Empirical Evaluation Results

The empirical study analyzed a benchmark dataset of 15 open-source React projects to answer three research questions regarding Prop Drilling occurrences, complexity, and eliminability RQ2 found that while higher-depth instances (≥ 2) account for about 20% of all PDs, breadth complexity is more prevalent as 54.9% of all PDs participate in Compound Prop Drillings (CPDs) RQ3 showed that the Context API strategy enables the automated refactoring of 74. p. 0

Where the paper says it

The main findings of the empirical evaluation indicate (a) the frequent occurrence of prop drillings across benchmark projects, irrespective of project size; (b) their generally low to moderate complexity in terms of data propagation depth, contrasted with the more prevalent complexity arising from the simultaneous forwarding of multiple properties along the same path; and, (c) the potential for automated elimination of a substantial share (76. 3%) of prop drillings, primarily through refactoring to the Context API.

9% of all identified PDs and Component Composition to 7. p. 6
Where the paper says it

As will be further discussed in the rest of this section, Carbon developers resorted to the Prop Drilling approach, in order to propagate configuration information from the Editor component to the deeply nested TitleBar component. A detailed description of the identified Prop Drilling instances will be provided after a formal definition of the Prop Drilling concept.

3%. Overall, 76.3% of all PDs and 73.6% of PPDs can be refactored using at least one of the considered strategies. p. 8
Where the paper says it

, the source and target components do not share a parentchild relationship, • |path(P Ds,t,j )| ≥ 3, i. , it includes at least one intermediate component, • P P0 ≡ P Ps,0,k, the first element is a prop passing from the source component Cs towards some component C0 with respect to a property pk ∈ P0, • P Pn ≡ P Fn−1,t,l,j , the last element is a prop forwarding from a component Cn−1 to the target component Ct and its property pj ∈ Pt, • P Pi ≡ P Fi−1,i,r,s, i ∈ [1, n−1], any other element is, also, a prop forwarding from Ci−1 to Ci , • given any pair of consecutive elements (P Pi−1, P Pi), it holds that P Pi−1 ≡ P Fi−2,i−1,m,r ∧ P Pi ≡ P Fi−1,i,r,s, i.

Conclusion

The proposed method has been implemented as a Node.js command line tool, ReactRefactor, which allows users to select a refactoring strategy through an interactive command line menu The results demonstrate the potential of the proposed method to identify data propagation complexity and mitigate it through native React capabilities. p. 0

Where the paper says it

js command line tool, ReactRefactor, and empirically evaluated on a benchmark dataset of open-source React applications. The main findings of the empirical evaluation indicate (a) the frequent occurrence of prop drillings across benchmark projects, irrespective of project size; (b) their generally low to moderate complexity in terms of data propagation depth, contrasted with the more prevalent complexity arising from the simultaneous forwarding of multiple properties along the same path; and, (c) the potential for automated elimination of a substantial share (76.

Future work could investigate additional refactoring strategies or generalize the proposed method to other component-based UI frameworks. p. 0
Where the paper says it

In this work, we propose a static analysis method for identifying Prop Drilling instances in a React codebase and eliminating them using two automated refactoring strategies based on Context API and Component Composition. The proposed method is implemented as a Node.

References

[1] Meta Open Source, React Official Documentation, https://react.dev, 2026

[3] React Documentation, Passing Data Deeply with Context, https://react.dev/learn/passing-data-deeply-with-context, 2026

[4] F. Ferreira, M. p. 4

Where the paper says it

Research on framework-specific code smells remains relatively scarce despite the widespread adoption of front-end frameworks. Regarding the React framework, Ferreira and Valente [4] proposed a catalog of 12 code smells and a tool, ReactSniffer, for their automated detection in a given codebase.

T. Valente, Detecting code smells in react-based web apps, Inf. p. 4
Where the paper says it

Research on framework-specific code smells remains relatively scarce despite the widespread adoption of front-end frameworks. Regarding the React framework, Ferreira and Valente [4] proposed a catalog of 12 code smells and a tool, ReactSniffer, for their automated detection in a given codebase.

Softw. Technol. 155 (2023) 107111

[5] F. Ferreira, H. p. 4

Where the paper says it

Research on framework-specific code smells remains relatively scarce despite the widespread adoption of front-end frameworks. Regarding the React framework, Ferreira and Valente [4] proposed a catalog of 12 code smells and a tool, ReactSniffer, for their automated detection in a given codebase.

S. Borges, M. T. Valente, Refactoring react-based web apps, J. p. 0
Where the paper says it

Keywords: React, Refactoring, Prop Drilling, Code smell, Component composition, Context API 1. Introduction React is a library for implementing dynamic and interactive web user interfaces in JavaScript (JS) and TypeScript (TS) [1].

Syst. Softw. 215 (2024)

[7] M Fowler, Refactoring: Improving the Design of Existing Code, 1st ed., Addison-Wesley Longman Publishing Co., Inc., Boston, MA, USA, 1999

[8] M Fowler, Refactoring: Improving the Design of Existing Code, 2nd ed., Addison-Wesley Longman Publishing Co., Inc., Boston, MA, USA, 2018

[9] G. Lacerda, F. Petrillo, M. Pimenta, Y. G. Guéhéneuc, Code smells and refactoring: A tertiary systematic review of challenges and observations, J. p. 4

Where the paper says it

In parallel to the study of code smells, several research efforts have focused on methods and tools for refactoring automation. Early approaches explored basic refactorings, with particular emphasis on the challenges introduced by the dynamic features of the JS language.

Syst. Softw. 167 (2020) 110610

[35] C. Wohlin, P. Runeson, M. Höst, M. C. Ohlsson, B. Regnell, A. Wesslén, Experimentation in Software Engineering, 1st edition, Springer, 2012

[36] V. Gkinis, V. E. Zafeirisb, Replication package: Refactoring React Component Hierarchies to Eliminate Prop Drilling, 2026

--- Page 1 ---

Refactoring React Component Hierarchies to Eliminate Prop Drilling

Vangelis Gkinisa, Vassilis E. Zafeirisb,∗ aDepartment of Informatics, Athens University of Economics and Business, Greece bComputer Science and Engineering Department, University of Ioannina, Greece

--- Page 2 ---

or simply components, in React terminology State management is one of the most challenging aspects of React development On the other hand, data propagation concerns the flow of information within the render tree and occurs during the initial rendering of the application, as well as on subsequent re-renders A standard approach for data propagation employs component properties or props; a component receives the required data through value assignments to its props (prop passings) in the returned JSX of the parent component In case that the data owner resides higher in the component hierarchy, data are forwarded through successive prop passings across intermediate components React, also, provides the Context API that allows data to be shared across entire subtrees without explicitly passing properties through intermediate components

--- Page 3 ---

The practice of propagating data through component properties across multiple levels of the component hierarchy is known as Prop Drilling According to the official React documentation, Prop Drilling should be avoided where possible, in favor of alternatives, such as the Context API [3] More recently, research on the maintainability of React codebases classifies Prop Drilling as a code smell due to the difficulty in tracing the origin and uses of forwarded property values

--- Page 4 ---

The identification of prop drilings is based on a graph representation of the React codebase – the Component Hierarchy Graph (CHG) – that statically approximates the parent-child relationships among components and the flow of data due to prop passings and prop forwardings A set of refactoring preconditions determine whether a Prop Drilling instance is refactorable and which refactoring strategies are applicable Finally, we specify source code transformation procedures for eliminating a Prop Drilling instance through either refactoring strategy

--- Page 5 ---

The rest of the paper is organized as follows. Section 2 presents related work and Section 3 provides a specification of the Prop Drilling code smell and its implications on code maintainability Moreover, in Section 4, we specify our method for identifying and refactoring Prop Drilling instances in a React codebase

--- Page 6 ---

Figure 5 presents a fragment of the CHG for the Carbon project All prop drillings target the properties of the TitleBar component The source component in two of them is Editor, which passes the titleBar and updateTitleBar local variables to respective properties of Carbon (indicated by the red arrow endings)

--- Page 7 ---

Prop Drilling Depth. The impact of Prop Drilling on code maintainability is affected by the number of intermediate components in Prop Drilling instances Compound Prop Drilling. p. 8

Where the paper says it

Prop Drilling Depth. The impact of Prop Drilling on code maintainability is affected by the number of intermediate components in Prop Drilling instances.

Besides depth, a further indication of the coupling level incurred due to Prop Drilling, is the number of properties that are simultaneously forwarded along the same path

--- Page 8 ---

A Prop Passing, in React jargon, is a value assignment to a child component’s property, in order to configure its rendering We define Prop Forwarding, as a special case of prop passing A Prop Drilling from Cs to Ct with respect to property pj ∈ Pt is defined as a sequence of prop passings P Ds,t,j = (P P0, P P1,..., P Pn)

--- Page 9 ---

A prop drilling has the following properties • Cs ↛ Ct, i.e., the source and target components do not share a parentchild relationship • path(P Ds,t,j) ≥ 3, i. p. 8

Where the paper says it

• Cs ↛ Ct, i. , the source and target components do not share a parentchild relationship, • |path(P Ds,t,j )| ≥ 3, i.

e., it includes at least one intermediate component • P P0 ≡ P Ps,0,k, the first element is a prop passing from the source component Cs towards some component C0 with respect to a property pk ∈ P0 • P Pn ≡ P Fn-1,t,l,j, the last element is a prop forwarding from a component Cn-1 to the target component Ct and its property pj ∈ Pt • P Pi ≡ P Fi-1,i,r,s, i ∈ [1, n−1], any other element is, also a prop forwarding from Ci-1 to Ci • given any pair of consecutive elements (P Pi-1, P Pi), it holds that P Pi-1 ≡ P Fi-2,i-1,m,r ∧ P Pi ≡ P Fi-1,i,r,s, i

--- Page 10 ---

Thus, within a prop drilling instance P Ds,t,j, a value defined in the source component Cs is forwarded through properties of intermediate components and is finally assigned to the property pj of the target component Ct Prop Drilling Depth. The higher the number of intermediates, the more components are unnecessarily coupled to the source and target components and affected by their data dependencies Compound Prop Drilling. p. 8

Where the paper says it

The impact of Prop Drilling on code maintainability is affected by the number of intermediate components in Prop Drilling instances. The higher the number of intermediates, the more components are unnecessarily coupled to the source and target components and affected by their data dependencies.

Besides depth, a further indication of the coupling level incurred due to Prop Drilling, is the number of properties that are simultaneously forwarded along the same path

--- Page 11 ---

Component Composition facilitates component extensibility by allowing child components to be nested within a component’s JSX markup, thereby enabling the declarative construction of complex UI fragments The elimination of Prop Drilling through the Context API has broader applicability

--- Page 12 ---

Figure 3: Declaration of the CarbonContextProvider component The context provider tag is applied in the JSX of the source component (Carbon) and encloses WindowControls, the target of the initial prop passing

--- Page 13 ---

In this section we introduce a method for identifying Prop Drilling instances in a React codebase and eliminating them through automated refactoring

--- Page 14 ---

Algorithm 2 Edge Resolution Procedure Figure 5 presents a fragment of the CHG for the Carbon project

--- Page 15 ---

Figure 5 presents a fragment of the CHG for the Carbon project Each edge is tagged with the cardinalities of the sets P P and P F inside parentheses

--- Page 16 ---

edge (2,4) among components C1 and WC denotes that Carbon sets values to 6 properties of the WindowControls tag in the returned JSX markup; two of them are plain prop passings and the rest are forwardings of Carbon properties

--- Page 17 ---

The set of prop passings of an edge ei is assigned to variable P Pi (line 8) The algorithm, then, proceeds with the next edge in the PF-path having as property to be matched If the sequence pd has at least 2 prop passings (line 21), then it is considered as a prop drilling and is added to pdSet of identified prop drillings

--- Page 18 ---

The actual processing of each prop passing pp ∈ P Pi is specified in lines 13–26 of the algorithm The set of prop passings of an edge ei is assigned to variable P Pi (line 8) The algorithm, then, proceeds with the next edge in the PF-path having as property to be matched If the sequence pd has at least 2 prop passings (line 21), then it is considered as a prop drilling and is added to pdSet of identified prop drillings

--- Page 19 ---

The identification of prop drillings along a given PF-path is performed by procedure searchPropDrillings, which is outlined in Algorithm 4 The algorithm, then, proceeds with the next edge in the PF-path having as property to be matched If the sequence pd has at least 2 prop passings (line 21), then it is considered as a prop drilling and is added to pdSet of identified prop drillings

--- Page 20 ---

Table 3 presents results on Compound Prop Drillings and their breadth distribution CPDs exceeding the minimum breadth account for 34.4% of all CPDs and their member PDs represent a notable share (28. p. 5

Where the paper says it

plugin for detecting function constructors that emulate classes and represent opportunities for refactoring to ES6 classes. [29], also, focus on the identification of class emulations, proposing a method and tool, called JSClassFinder.

p. 5
Where the paper says it

plugin for detecting function constructors that emulate classes and represent opportunities for refactoring to ES6 classes. [29], also, focus on the identification of class emulations, proposing a method and tool, called JSClassFinder.

3%) of all PDs

--- Page 21 ---

Figure 11 presents results on the applicability of refactoring strategies to All Prop Drillings and Pure Prop Drillings The results in Figure 11 highlight the broad applicability of the Context API refactoring strategy, specifically enabling the automated refactoring of 74.9% of all identified PDs and 71. p. 6

Where the paper says it

As will be further discussed in the rest of this section, Carbon developers resorted to the Prop Drilling approach, in order to propagate configuration information from the Editor component to the deeply nested TitleBar component. A detailed description of the identified Prop Drilling instances will be provided after a formal definition of the Prop Drilling concept.

p. 6
Where the paper says it

As will be further discussed in the rest of this section, Carbon developers resorted to the Prop Drilling approach, in order to propagate configuration information from the Editor component to the deeply nested TitleBar component. A detailed description of the identified Prop Drilling instances will be provided after a formal definition of the Prop Drilling concept.

6% of PPDs

--- Page 22 ---

The results in Figure 11 highlight the broad applicability of the Context API refactoring strategy, specifically enabling the automated refactoring of 74.9% of all identified PDs and 71.6% of PPDs At the project level, it is applicable to at least 28. p. 6

Where the paper says it

Figure 1 presents a part of the project’s component hierarchy, comprising core components of the application’s UI. Specifically, Editor represents the top-level component of the UI, while Carbon shows the highlighted code snippet in an area that resembles a terminal emulator window.

6% of PDs (median value 76%) and 33. p. 1
Where the paper says it

On a technical basis, the reconciliation process is triggered by a state update, i. an update to the value of a component’s state variable somewhere in the render tree.

3% of PPDs (median value 78. p. 1
Where the paper says it

On a technical basis, the reconciliation process is triggered by a state update, i. an update to the value of a component’s state variable somewhere in the render tree.

4)

--- Page 25 ---

AQ 1. Prop Drilling is frequently encountered in real-world applications, irrespective of their size AQ 2. p. 2

Where the paper says it

To the best of our knowledge this is the first work that studies the automation of a large-scale refactoring in a React codebase. Moreover, it is among the few studies that investigate the prevalence of code smells in real-world React applications and the first to focus specifically on Prop Drilling.

Prop drillings (PDs) generally exhibit low depth complexity

--- Page 28 ---

Depth 1 2 3 4+

85.5 11.8 2.2 0.4 Depth distribution for All Prop Drillings and Pure Prop Drillings

--- Page 30 ---

Table 3 presents results on Compound Prop Drillings and their breadth distribution CPDs exceeding the minimum breadth account for 34.4% of all CPDs and their member PDs represent a notable share (28.

Green — the paper says it, and the page is printed. Red — no passage carries it, so treat that sentence as unverified. The same check runs on your own text: check a summary against its source, $5.

Improvements for AI systems

  1. Static analysis method for identifying Prop Drilling instances in a React codebase can be integrated into IDE tools to provide real-time suggestions for refactoring candidates by recovering a Component Hierarchy Graph (CHG).

  2. The AI system can utilize graph traversal algorithms, such as the one described in Algorithm 3, to systematically search through Prop Forwarding paths to construct and identify complex Prop Drilling instances across large codebases.

  3. The tool can automatically evaluate refactoring preconditions for both Component Composition and Context API strategies, classifying each instance as a candidate for refactoring or rejecting it based on defined rules (RP1 through RP7).

  4. For identified Compound Prop Drillings, the system can apply source code transformation procedures to either replace intermediate components with nested tags (Component Composition) or wrap the subtree in a Context Provider (Context API).

  5. The AI system can quantify Prop Drilling complexity using depth and breadth metrics derived from CHG analysis, allowing developers to prioritize refactoring efforts on instances that exhibit high coupling strength.

Abstract

In React front-end development, Prop Drilling is the practice of propagating data through component properties across multiple levels of the component hierarchy. Despite being discouraged by React documentation and characterized as a code smell by recent research, little is known about its prevalence, complexity, and potential for automated refactoring. In this work, we propose a static analysis method for identifying Prop Drilling instances in a React codebase and eliminating them using two automated refactoring strategies based on Context API and Component Composition. The proposed method is implemented as a Nodejs command line tool, ReactRefactor, and empirically evaluated on a benchmark dataset of open-source React applications. The main findings of the empirical evaluation indicate (a) the frequent occurrence of prop drillings across benchmark projects, irrespective of project size; (b) their generally low to moderate complexity in terms of data propagation depth, contrasted with the more prevalent complexity arising from the simultaneous forwarding of multiple properties along the same path; and, (c) the potential for automated elimination of a substantial share (76.3%) of prop drillings, primarily through refactoring to the Context API.

Related papers