Section List with multi-level nested array in react native

453 views Asked by At

I am trying to display a Section List in React Native for an array that's within an array that's within another array. I am able to get to the second-level array, but not the one I want to display. The json looks something like this:

[
  {
    "id": 1,
    "name": "Los Angeles",
    "community": [
      {
        "id": 1,
        "name": "Venice",
        "streets": [
          {
            "id": 1,
            "name": "Kinney"

I was able to reach the community level by transforming the data source as follows:

const transformedData = responseJson.map(elem => ({
    key: elem.id,
    title: elem.name,
    data: elem.community,

but I don't know how to go one level deeper. How would I create a section list with the title as the community name and the data as the streets information? Thank you!

0

There are 0 answers