Questions tagged [prop-drilling]

In React, a code smell consisting on passing the (parameter) properties of children components to the parent component's parameter lists, without the parents doing anything other than just passing them upwards.

6 questions
7
votes
0 answers

How to avoid prop drilling in Jetpack Compose

I'll try to describe the problem with a short example. Lets assume we have a child composable representing a custom switch, and we want to keep it immutable, so we need to pass the initial state and also a lambda to change its source of truth when…
Mister Smith
  • 27,417
  • 21
  • 110
  • 193
0
votes
0 answers

Trouble Understanding React.memo on a Component

Please take a look at the following code // index.jsx import React from 'react'; import {data} from '../../../../data.js'; import List from './List.jsx'; const peopleContext = React.createContext(); export const usePeopleContext = () =>…
0
votes
1 answer

How to prevent prop drilling with SSR in Next

I'm wondering how I can prevent prop drilling with SSR in the following situation: Layout.tsx: export default function RootLayout({ children, }: { children: React.ReactNode; }) { const user = await…
Alexander
  • 396
  • 1
  • 9
  • 19
0
votes
3 answers

React alternative way to prop drilling (reverse, from child to parents) for handling forms

I'm new to React and learning it by making some practice projects. I'm currently working on form handling and validation. I use React Router's Form component in my SPA and within the form I have my FormGroup element which renders labels inputs and…
M. Çağlar TUFAN
  • 626
  • 1
  • 7
  • 21
0
votes
0 answers

Drill into xml file for data with colon in name

I'm trying to do a script to compare gpo's from a list generated with "Get-GPOReport -All -ReportType csv". I'm running into issues because i dont know how to drill into the q3:policy data. I'm pulling data from other sections of xml but under…
ben s
  • 11
  • 2
0
votes
1 answer

For React Prop Drilling, why is it that I can only pass one State Parameter instead of both the State and the State Setter?

This is just a simple concept question I am trying to understand as I use and learn React, but why can I only send one State Parameter through Prop Drilling? This is if I use either UseState or if I use the XState platform. I don't know if this has…