Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

247
Views
force rendering function component when change dropdown value in a dynamic list of components - react native

I have a function component in which i want to add (with a plus button +) a group of rows, each row contains Text Inputs and Dropdown picker. so a I create a globale state contains 2 lists , one will have the components (<TextInput ...> ,<Picker ...> ) and the other will have the state of the value we pass to the components so that i can match the two object in the list by theirs indexes:

const [stockGroupes, setStockGroupes] = useState({
groupsInfoInputs: [],
groupsInfoData: [],
});

image show how the render will be in the function component

the problem is : when i click to dropdown and I choose some value the state changed ( in groupsInfoData[ index of the dropdown ] ) but the value in dropdown still fix ("AGA.." like is shown in the image above ) , it's some how like when the component are created dynamically they doesn't re-render when state changed, is that true ? and how i can force re-render when the state change. I hope I was able to describe my issue, if you want some more explanation let me know.

EDIT : when i use this approach to force re-render

const useForceUpdateInside = () => {
const [value, setValue] = useState(0); // integer state
return () => setValue((value) => value + 1); // update the state to 
force render
};

the problem solved , but i get the error just after that because I call the useForceUpdateInside inside a the function that change the value of dropdwon:

(Error: Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:)

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!