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

167
Views
Can't pass the state props, says undefined

I have bee trying to pass the notes data to another component But I don't know why it says undefined.

export default App = () => {
  const [notes, setNotes] = useState([
    { key: 1, value: "Hello there what up", title: "Some Title for this" },
    { key: 2, value: "I want to take notes", title: "another for this one" },
  ]);

  return (
    <View>
      <FlatList
        data={notes}
        renderItem={({ note }) => (
          <View>
            <NoteItem note={note} />
          </View>
        )}
      />
    </View>
  );
};
export default NoteItem = ({ note }) => {
    <Text>{note.title}</Text>
  );
};
about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

First of you assume that renderItem in Flatlist has a 'note' property inside it. It does not, it is called item. Also you pass notes but you try to deconstruct note? It should be like this:

export default App = () => {
  const [notes, setNotes] = useState([
    { key: 1, value: "Hello there what up", title: "Some Title for this" },
    { key: 2, value: "I want to take notes", title: "another for this one" },
  ]);

  return (
    <View>
      <FlatList
        data={notes}
        renderItem={({ item }) => (
          <View>
            <NoteItem note={item} />
          </View>
        )}
      />
    </View>
  );
};
about 4 years ago · Juan Pablo Isaza Report

0

This syntax - ({ note }) - means that the NoteItem component expects a prop named note to be set; however, you're setting the notes prop instead.

Try this:

<FlatList
   data={notes}
   renderItem={({ item, index }) => (
     <View key={index}>
       <NoteItem note={item} />
     </View>
   )}
/>
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!