Skip to content
Advertisement

React Native, FlatList does not output my list correctly

I have this quite easy items where I normally loop over with map:

JavaScript

The above code works fine, but as I learned, it is better do use FlatList in my components do render something in a loop. So I tried the following:

JavaScript

The correct amount of items are rendered, but unfortunately, none of the props gets passed to the Child component. Getting undefined undefined true.

What am I doing wrong here? Why is my data not correctly passed?

Advertisement

Answer

You are not giving renderItem a function with the right parameter. Here is its signature from the doc:

JavaScript

Change your code to this:

JavaScript
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement