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

144
Views
Flatlist variable sent with navigate in React native but cannot be displayed

I passed and declared a variable(item) with navigate, but inside "return", It says undefined.

here variable(item)

{id: "001"
name: "name"}

code

import React, {useState,useEffect} from "react";
import {Text, View} from "react-native";
import styled from "styled-components/native";
import { TouchableWithoutFeedback, TouchableOpacity} from "react-native-gesture-handler";


const PlaySystem= ({navigation,route}) =>  {
  
const {data}= useState(null)
    useEffect(()=>{
    let {data} =route.params;
    console.log("first",data.id)

  },[])
  
    return ( 
     <Container>
      <StatusBar barStyle="Light-content"/>
       <View>
           <Text>{data?.name}</Text>
           { console.log("second",data.id) }
       </View>

     </Container>);}
export default PlaySystem;

console.log shows:

second undefined
first 001
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

do it like this -

const PlaySystem= ({navigation,route}) =>  {
   let {data} =route.params;

    return ( 
     <Container>
      <StatusBar barStyle="Light-content"/>
       <View>
           <Text>{data?.name}</Text>
       </View>

     </Container>);}
export default PlaySystem;
about 4 years ago · Juan Pablo Isaza Report
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!