How can I map over and object, that contains another Object I want to map over and return JSX from it?












0















My Problem



I have mockdata Object that looks like that:



topicGroups: {
0: {
title: "Languages",
topics: {
0: {
title: "Javascript",
description: "Everything about Vanilla JS",
latestTopic:
"Diskussion] Der ideale asdf Gaming-PC er ideale asdf Gamin(1..."
},
1: {
title: "C#",
description: "Microsoft's go to language",
latestTopic: "Main geiles Topic alter"
}
}
},
1: {
title: "Coding Partner Search",
topics: {
0: {
title: "Suche nach Liebe",
description: "Everything about Vanilla JS",
latestTopic:
"Diskussion] Der ideale asdf Gaming-PC er ideale asdf Gamin(1..."
}
}
}
}


I want to achieve the following:




  • Map over all the topics groups (to get access to the title string and topics object.

  • Map over the topics object inside the first map (so I'm in scope for the group title)

  • Return Jsx where I use just the group's title and current topic title and description


I tried it with several lodash functions, but I can't make it work. The closest I got was to create another fresh object besides topicGroups, but then it is difficult to figure out which topics refers to which topicGroups.



Example how I want to use the jsx and what I want to return:



return groups.map(group =>
group.topics.map(topic => {
return (
<ForumTopicGroup title={group.title}>
<ForumTopic>{topic.title}</ForumTopic>
</ForumTopicGroup>
);
})
);


What is the best and most clean way to achieve this?



The reason why I have my data like only with object instead of using arrays is, because I want to work with this data like it comes from firebase (as I will use firebase later on in the application










share|improve this question

























  • When you say return JSX where you use just the group's title and current topic, can you be a bit more specific about what you want returned?

    – theapologist
    Nov 15 '18 at 11:06











  • @LloydFrancis I'm sorry. Of course, I edited the post with an example.

    – GeraltDieSocke
    Nov 15 '18 at 11:08











  • If you have an object with keys 0, 1, ... , you might want to use an array instead.

    – Tholle
    Nov 15 '18 at 11:11











  • @Tholle Read the last part of the post in bold text. I use it like this because firebase is also fetching the data this way.

    – GeraltDieSocke
    Nov 15 '18 at 11:11











  • @Tholle as mentioned in the OP, that is a no-go as he wants to work with data that come from firebase

    – theapologist
    Nov 15 '18 at 11:11
















0















My Problem



I have mockdata Object that looks like that:



topicGroups: {
0: {
title: "Languages",
topics: {
0: {
title: "Javascript",
description: "Everything about Vanilla JS",
latestTopic:
"Diskussion] Der ideale asdf Gaming-PC er ideale asdf Gamin(1..."
},
1: {
title: "C#",
description: "Microsoft's go to language",
latestTopic: "Main geiles Topic alter"
}
}
},
1: {
title: "Coding Partner Search",
topics: {
0: {
title: "Suche nach Liebe",
description: "Everything about Vanilla JS",
latestTopic:
"Diskussion] Der ideale asdf Gaming-PC er ideale asdf Gamin(1..."
}
}
}
}


I want to achieve the following:




  • Map over all the topics groups (to get access to the title string and topics object.

  • Map over the topics object inside the first map (so I'm in scope for the group title)

  • Return Jsx where I use just the group's title and current topic title and description


I tried it with several lodash functions, but I can't make it work. The closest I got was to create another fresh object besides topicGroups, but then it is difficult to figure out which topics refers to which topicGroups.



Example how I want to use the jsx and what I want to return:



return groups.map(group =>
group.topics.map(topic => {
return (
<ForumTopicGroup title={group.title}>
<ForumTopic>{topic.title}</ForumTopic>
</ForumTopicGroup>
);
})
);


What is the best and most clean way to achieve this?



The reason why I have my data like only with object instead of using arrays is, because I want to work with this data like it comes from firebase (as I will use firebase later on in the application










share|improve this question

























  • When you say return JSX where you use just the group's title and current topic, can you be a bit more specific about what you want returned?

    – theapologist
    Nov 15 '18 at 11:06











  • @LloydFrancis I'm sorry. Of course, I edited the post with an example.

    – GeraltDieSocke
    Nov 15 '18 at 11:08











  • If you have an object with keys 0, 1, ... , you might want to use an array instead.

    – Tholle
    Nov 15 '18 at 11:11











  • @Tholle Read the last part of the post in bold text. I use it like this because firebase is also fetching the data this way.

    – GeraltDieSocke
    Nov 15 '18 at 11:11











  • @Tholle as mentioned in the OP, that is a no-go as he wants to work with data that come from firebase

    – theapologist
    Nov 15 '18 at 11:11














0












0








0








My Problem



I have mockdata Object that looks like that:



topicGroups: {
0: {
title: "Languages",
topics: {
0: {
title: "Javascript",
description: "Everything about Vanilla JS",
latestTopic:
"Diskussion] Der ideale asdf Gaming-PC er ideale asdf Gamin(1..."
},
1: {
title: "C#",
description: "Microsoft's go to language",
latestTopic: "Main geiles Topic alter"
}
}
},
1: {
title: "Coding Partner Search",
topics: {
0: {
title: "Suche nach Liebe",
description: "Everything about Vanilla JS",
latestTopic:
"Diskussion] Der ideale asdf Gaming-PC er ideale asdf Gamin(1..."
}
}
}
}


I want to achieve the following:




  • Map over all the topics groups (to get access to the title string and topics object.

  • Map over the topics object inside the first map (so I'm in scope for the group title)

  • Return Jsx where I use just the group's title and current topic title and description


I tried it with several lodash functions, but I can't make it work. The closest I got was to create another fresh object besides topicGroups, but then it is difficult to figure out which topics refers to which topicGroups.



Example how I want to use the jsx and what I want to return:



return groups.map(group =>
group.topics.map(topic => {
return (
<ForumTopicGroup title={group.title}>
<ForumTopic>{topic.title}</ForumTopic>
</ForumTopicGroup>
);
})
);


What is the best and most clean way to achieve this?



The reason why I have my data like only with object instead of using arrays is, because I want to work with this data like it comes from firebase (as I will use firebase later on in the application










share|improve this question
















My Problem



I have mockdata Object that looks like that:



topicGroups: {
0: {
title: "Languages",
topics: {
0: {
title: "Javascript",
description: "Everything about Vanilla JS",
latestTopic:
"Diskussion] Der ideale asdf Gaming-PC er ideale asdf Gamin(1..."
},
1: {
title: "C#",
description: "Microsoft's go to language",
latestTopic: "Main geiles Topic alter"
}
}
},
1: {
title: "Coding Partner Search",
topics: {
0: {
title: "Suche nach Liebe",
description: "Everything about Vanilla JS",
latestTopic:
"Diskussion] Der ideale asdf Gaming-PC er ideale asdf Gamin(1..."
}
}
}
}


I want to achieve the following:




  • Map over all the topics groups (to get access to the title string and topics object.

  • Map over the topics object inside the first map (so I'm in scope for the group title)

  • Return Jsx where I use just the group's title and current topic title and description


I tried it with several lodash functions, but I can't make it work. The closest I got was to create another fresh object besides topicGroups, but then it is difficult to figure out which topics refers to which topicGroups.



Example how I want to use the jsx and what I want to return:



return groups.map(group =>
group.topics.map(topic => {
return (
<ForumTopicGroup title={group.title}>
<ForumTopic>{topic.title}</ForumTopic>
</ForumTopicGroup>
);
})
);


What is the best and most clean way to achieve this?



The reason why I have my data like only with object instead of using arrays is, because I want to work with this data like it comes from firebase (as I will use firebase later on in the application







javascript reactjs lodash






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 15 '18 at 11:08







GeraltDieSocke

















asked Nov 15 '18 at 11:01









GeraltDieSockeGeraltDieSocke

308115




308115













  • When you say return JSX where you use just the group's title and current topic, can you be a bit more specific about what you want returned?

    – theapologist
    Nov 15 '18 at 11:06











  • @LloydFrancis I'm sorry. Of course, I edited the post with an example.

    – GeraltDieSocke
    Nov 15 '18 at 11:08











  • If you have an object with keys 0, 1, ... , you might want to use an array instead.

    – Tholle
    Nov 15 '18 at 11:11











  • @Tholle Read the last part of the post in bold text. I use it like this because firebase is also fetching the data this way.

    – GeraltDieSocke
    Nov 15 '18 at 11:11











  • @Tholle as mentioned in the OP, that is a no-go as he wants to work with data that come from firebase

    – theapologist
    Nov 15 '18 at 11:11



















  • When you say return JSX where you use just the group's title and current topic, can you be a bit more specific about what you want returned?

    – theapologist
    Nov 15 '18 at 11:06











  • @LloydFrancis I'm sorry. Of course, I edited the post with an example.

    – GeraltDieSocke
    Nov 15 '18 at 11:08











  • If you have an object with keys 0, 1, ... , you might want to use an array instead.

    – Tholle
    Nov 15 '18 at 11:11











  • @Tholle Read the last part of the post in bold text. I use it like this because firebase is also fetching the data this way.

    – GeraltDieSocke
    Nov 15 '18 at 11:11











  • @Tholle as mentioned in the OP, that is a no-go as he wants to work with data that come from firebase

    – theapologist
    Nov 15 '18 at 11:11

















When you say return JSX where you use just the group's title and current topic, can you be a bit more specific about what you want returned?

– theapologist
Nov 15 '18 at 11:06





When you say return JSX where you use just the group's title and current topic, can you be a bit more specific about what you want returned?

– theapologist
Nov 15 '18 at 11:06













@LloydFrancis I'm sorry. Of course, I edited the post with an example.

– GeraltDieSocke
Nov 15 '18 at 11:08





@LloydFrancis I'm sorry. Of course, I edited the post with an example.

– GeraltDieSocke
Nov 15 '18 at 11:08













If you have an object with keys 0, 1, ... , you might want to use an array instead.

– Tholle
Nov 15 '18 at 11:11





If you have an object with keys 0, 1, ... , you might want to use an array instead.

– Tholle
Nov 15 '18 at 11:11













@Tholle Read the last part of the post in bold text. I use it like this because firebase is also fetching the data this way.

– GeraltDieSocke
Nov 15 '18 at 11:11





@Tholle Read the last part of the post in bold text. I use it like this because firebase is also fetching the data this way.

– GeraltDieSocke
Nov 15 '18 at 11:11













@Tholle as mentioned in the OP, that is a no-go as he wants to work with data that come from firebase

– theapologist
Nov 15 '18 at 11:11





@Tholle as mentioned in the OP, that is a no-go as he wants to work with data that come from firebase

– theapologist
Nov 15 '18 at 11:11












2 Answers
2






active

oldest

votes


















1














It would work like you have written it in your question if you could use arrays, but since objects don't have a map method, you could use Object.entries instead to iterate over all the key-value pairs in the objects.



Example






const groups = {
0: {
title: "Languages",
topics: {
0: {
title: "Javascript",
description: "Everything about Vanilla JS",
latestTopic:
"Diskussion] Der ideale asdf Gaming-PC er ideale asdf Gamin(1..."
},
1: {
title: "C#",
description: "Microsoft's go to language",
latestTopic: "Main geiles Topic alter"
}
}
},
1: {
title: "Coding Partner Search",
topics: {
0: {
title: "Suche nach Liebe",
description: "Everything about Vanilla JS",
latestTopic:
"Diskussion] Der ideale asdf Gaming-PC er ideale asdf Gamin(1..."
}
}
}
};

function App() {
return (
<div>
{Object.entries(groups).map(([groupKey, group]) => (
<div key={groupKey}>
{Object.entries(group.topics).map(([topicKey, topic]) => {
return (
<div key={topicKey}>
{group.title} - {topic.title}
</div>
);
})}
</div>
))}
</div>
);
}

ReactDOM.render(<App />, document.getElementById("root"));

<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.1.0/react.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.1.0/react-dom.min.js"></script>

<div id="root"></div>








share|improve this answer

































    0














    I wrote a small JS function for this, hopefully you can use this and convert into JSX.



    let data = {
    0: {
    title: "Languages",
    topics: {
    0: {
    title: "Javascript",
    description: "Everything about Vanilla JS",
    latestTopic:
    "Diskussion] Der ideale asdf Gaming-PC er ideale asdf Gamin(1..."
    },
    1: {
    title: "C#",
    description: "Microsoft's go to language",
    latestTopic: "Main geiles Topic alter"
    }
    }
    },
    1: {
    title: "Coding Partner Search",
    topics: {
    0: {
    title: "Suche nach Liebe",
    description: "Everything about Vanilla JS",
    latestTopic:
    "Diskussion] Der ideale asdf Gaming-PC er ideale asdf Gamin(1..."
    }
    }
    }
    };

    Object.keys(data).forEach(key => {
    let { title, topics } = data[key];
    Object.keys(topics).forEach(key => {
    console.log(`Topic title -> ${topics[key].title}`, `Group title -> ${title}`);
    });
    });





    share|improve this answer























      Your Answer






      StackExchange.ifUsing("editor", function () {
      StackExchange.using("externalEditor", function () {
      StackExchange.using("snippets", function () {
      StackExchange.snippets.init();
      });
      });
      }, "code-snippets");

      StackExchange.ready(function() {
      var channelOptions = {
      tags: "".split(" "),
      id: "1"
      };
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function() {
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled) {
      StackExchange.using("snippets", function() {
      createEditor();
      });
      }
      else {
      createEditor();
      }
      });

      function createEditor() {
      StackExchange.prepareEditor({
      heartbeatType: 'answer',
      autoActivateHeartbeat: false,
      convertImagesToLinks: true,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: 10,
      bindNavPrevention: true,
      postfix: "",
      imageUploader: {
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      },
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      });


      }
      });














      draft saved

      draft discarded


















      StackExchange.ready(
      function () {
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53317981%2fhow-can-i-map-over-and-object-that-contains-another-object-i-want-to-map-over-a%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      1














      It would work like you have written it in your question if you could use arrays, but since objects don't have a map method, you could use Object.entries instead to iterate over all the key-value pairs in the objects.



      Example






      const groups = {
      0: {
      title: "Languages",
      topics: {
      0: {
      title: "Javascript",
      description: "Everything about Vanilla JS",
      latestTopic:
      "Diskussion] Der ideale asdf Gaming-PC er ideale asdf Gamin(1..."
      },
      1: {
      title: "C#",
      description: "Microsoft's go to language",
      latestTopic: "Main geiles Topic alter"
      }
      }
      },
      1: {
      title: "Coding Partner Search",
      topics: {
      0: {
      title: "Suche nach Liebe",
      description: "Everything about Vanilla JS",
      latestTopic:
      "Diskussion] Der ideale asdf Gaming-PC er ideale asdf Gamin(1..."
      }
      }
      }
      };

      function App() {
      return (
      <div>
      {Object.entries(groups).map(([groupKey, group]) => (
      <div key={groupKey}>
      {Object.entries(group.topics).map(([topicKey, topic]) => {
      return (
      <div key={topicKey}>
      {group.title} - {topic.title}
      </div>
      );
      })}
      </div>
      ))}
      </div>
      );
      }

      ReactDOM.render(<App />, document.getElementById("root"));

      <script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.1.0/react.min.js"></script>
      <script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.1.0/react-dom.min.js"></script>

      <div id="root"></div>








      share|improve this answer






























        1














        It would work like you have written it in your question if you could use arrays, but since objects don't have a map method, you could use Object.entries instead to iterate over all the key-value pairs in the objects.



        Example






        const groups = {
        0: {
        title: "Languages",
        topics: {
        0: {
        title: "Javascript",
        description: "Everything about Vanilla JS",
        latestTopic:
        "Diskussion] Der ideale asdf Gaming-PC er ideale asdf Gamin(1..."
        },
        1: {
        title: "C#",
        description: "Microsoft's go to language",
        latestTopic: "Main geiles Topic alter"
        }
        }
        },
        1: {
        title: "Coding Partner Search",
        topics: {
        0: {
        title: "Suche nach Liebe",
        description: "Everything about Vanilla JS",
        latestTopic:
        "Diskussion] Der ideale asdf Gaming-PC er ideale asdf Gamin(1..."
        }
        }
        }
        };

        function App() {
        return (
        <div>
        {Object.entries(groups).map(([groupKey, group]) => (
        <div key={groupKey}>
        {Object.entries(group.topics).map(([topicKey, topic]) => {
        return (
        <div key={topicKey}>
        {group.title} - {topic.title}
        </div>
        );
        })}
        </div>
        ))}
        </div>
        );
        }

        ReactDOM.render(<App />, document.getElementById("root"));

        <script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.1.0/react.min.js"></script>
        <script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.1.0/react-dom.min.js"></script>

        <div id="root"></div>








        share|improve this answer




























          1












          1








          1







          It would work like you have written it in your question if you could use arrays, but since objects don't have a map method, you could use Object.entries instead to iterate over all the key-value pairs in the objects.



          Example






          const groups = {
          0: {
          title: "Languages",
          topics: {
          0: {
          title: "Javascript",
          description: "Everything about Vanilla JS",
          latestTopic:
          "Diskussion] Der ideale asdf Gaming-PC er ideale asdf Gamin(1..."
          },
          1: {
          title: "C#",
          description: "Microsoft's go to language",
          latestTopic: "Main geiles Topic alter"
          }
          }
          },
          1: {
          title: "Coding Partner Search",
          topics: {
          0: {
          title: "Suche nach Liebe",
          description: "Everything about Vanilla JS",
          latestTopic:
          "Diskussion] Der ideale asdf Gaming-PC er ideale asdf Gamin(1..."
          }
          }
          }
          };

          function App() {
          return (
          <div>
          {Object.entries(groups).map(([groupKey, group]) => (
          <div key={groupKey}>
          {Object.entries(group.topics).map(([topicKey, topic]) => {
          return (
          <div key={topicKey}>
          {group.title} - {topic.title}
          </div>
          );
          })}
          </div>
          ))}
          </div>
          );
          }

          ReactDOM.render(<App />, document.getElementById("root"));

          <script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.1.0/react.min.js"></script>
          <script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.1.0/react-dom.min.js"></script>

          <div id="root"></div>








          share|improve this answer















          It would work like you have written it in your question if you could use arrays, but since objects don't have a map method, you could use Object.entries instead to iterate over all the key-value pairs in the objects.



          Example






          const groups = {
          0: {
          title: "Languages",
          topics: {
          0: {
          title: "Javascript",
          description: "Everything about Vanilla JS",
          latestTopic:
          "Diskussion] Der ideale asdf Gaming-PC er ideale asdf Gamin(1..."
          },
          1: {
          title: "C#",
          description: "Microsoft's go to language",
          latestTopic: "Main geiles Topic alter"
          }
          }
          },
          1: {
          title: "Coding Partner Search",
          topics: {
          0: {
          title: "Suche nach Liebe",
          description: "Everything about Vanilla JS",
          latestTopic:
          "Diskussion] Der ideale asdf Gaming-PC er ideale asdf Gamin(1..."
          }
          }
          }
          };

          function App() {
          return (
          <div>
          {Object.entries(groups).map(([groupKey, group]) => (
          <div key={groupKey}>
          {Object.entries(group.topics).map(([topicKey, topic]) => {
          return (
          <div key={topicKey}>
          {group.title} - {topic.title}
          </div>
          );
          })}
          </div>
          ))}
          </div>
          );
          }

          ReactDOM.render(<App />, document.getElementById("root"));

          <script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.1.0/react.min.js"></script>
          <script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.1.0/react-dom.min.js"></script>

          <div id="root"></div>








          const groups = {
          0: {
          title: "Languages",
          topics: {
          0: {
          title: "Javascript",
          description: "Everything about Vanilla JS",
          latestTopic:
          "Diskussion] Der ideale asdf Gaming-PC er ideale asdf Gamin(1..."
          },
          1: {
          title: "C#",
          description: "Microsoft's go to language",
          latestTopic: "Main geiles Topic alter"
          }
          }
          },
          1: {
          title: "Coding Partner Search",
          topics: {
          0: {
          title: "Suche nach Liebe",
          description: "Everything about Vanilla JS",
          latestTopic:
          "Diskussion] Der ideale asdf Gaming-PC er ideale asdf Gamin(1..."
          }
          }
          }
          };

          function App() {
          return (
          <div>
          {Object.entries(groups).map(([groupKey, group]) => (
          <div key={groupKey}>
          {Object.entries(group.topics).map(([topicKey, topic]) => {
          return (
          <div key={topicKey}>
          {group.title} - {topic.title}
          </div>
          );
          })}
          </div>
          ))}
          </div>
          );
          }

          ReactDOM.render(<App />, document.getElementById("root"));

          <script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.1.0/react.min.js"></script>
          <script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.1.0/react-dom.min.js"></script>

          <div id="root"></div>





          const groups = {
          0: {
          title: "Languages",
          topics: {
          0: {
          title: "Javascript",
          description: "Everything about Vanilla JS",
          latestTopic:
          "Diskussion] Der ideale asdf Gaming-PC er ideale asdf Gamin(1..."
          },
          1: {
          title: "C#",
          description: "Microsoft's go to language",
          latestTopic: "Main geiles Topic alter"
          }
          }
          },
          1: {
          title: "Coding Partner Search",
          topics: {
          0: {
          title: "Suche nach Liebe",
          description: "Everything about Vanilla JS",
          latestTopic:
          "Diskussion] Der ideale asdf Gaming-PC er ideale asdf Gamin(1..."
          }
          }
          }
          };

          function App() {
          return (
          <div>
          {Object.entries(groups).map(([groupKey, group]) => (
          <div key={groupKey}>
          {Object.entries(group.topics).map(([topicKey, topic]) => {
          return (
          <div key={topicKey}>
          {group.title} - {topic.title}
          </div>
          );
          })}
          </div>
          ))}
          </div>
          );
          }

          ReactDOM.render(<App />, document.getElementById("root"));

          <script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.1.0/react.min.js"></script>
          <script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.1.0/react-dom.min.js"></script>

          <div id="root"></div>






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Nov 15 '18 at 13:55

























          answered Nov 15 '18 at 11:24









          TholleTholle

          38.1k54264




          38.1k54264

























              0














              I wrote a small JS function for this, hopefully you can use this and convert into JSX.



              let data = {
              0: {
              title: "Languages",
              topics: {
              0: {
              title: "Javascript",
              description: "Everything about Vanilla JS",
              latestTopic:
              "Diskussion] Der ideale asdf Gaming-PC er ideale asdf Gamin(1..."
              },
              1: {
              title: "C#",
              description: "Microsoft's go to language",
              latestTopic: "Main geiles Topic alter"
              }
              }
              },
              1: {
              title: "Coding Partner Search",
              topics: {
              0: {
              title: "Suche nach Liebe",
              description: "Everything about Vanilla JS",
              latestTopic:
              "Diskussion] Der ideale asdf Gaming-PC er ideale asdf Gamin(1..."
              }
              }
              }
              };

              Object.keys(data).forEach(key => {
              let { title, topics } = data[key];
              Object.keys(topics).forEach(key => {
              console.log(`Topic title -> ${topics[key].title}`, `Group title -> ${title}`);
              });
              });





              share|improve this answer




























                0














                I wrote a small JS function for this, hopefully you can use this and convert into JSX.



                let data = {
                0: {
                title: "Languages",
                topics: {
                0: {
                title: "Javascript",
                description: "Everything about Vanilla JS",
                latestTopic:
                "Diskussion] Der ideale asdf Gaming-PC er ideale asdf Gamin(1..."
                },
                1: {
                title: "C#",
                description: "Microsoft's go to language",
                latestTopic: "Main geiles Topic alter"
                }
                }
                },
                1: {
                title: "Coding Partner Search",
                topics: {
                0: {
                title: "Suche nach Liebe",
                description: "Everything about Vanilla JS",
                latestTopic:
                "Diskussion] Der ideale asdf Gaming-PC er ideale asdf Gamin(1..."
                }
                }
                }
                };

                Object.keys(data).forEach(key => {
                let { title, topics } = data[key];
                Object.keys(topics).forEach(key => {
                console.log(`Topic title -> ${topics[key].title}`, `Group title -> ${title}`);
                });
                });





                share|improve this answer


























                  0












                  0








                  0







                  I wrote a small JS function for this, hopefully you can use this and convert into JSX.



                  let data = {
                  0: {
                  title: "Languages",
                  topics: {
                  0: {
                  title: "Javascript",
                  description: "Everything about Vanilla JS",
                  latestTopic:
                  "Diskussion] Der ideale asdf Gaming-PC er ideale asdf Gamin(1..."
                  },
                  1: {
                  title: "C#",
                  description: "Microsoft's go to language",
                  latestTopic: "Main geiles Topic alter"
                  }
                  }
                  },
                  1: {
                  title: "Coding Partner Search",
                  topics: {
                  0: {
                  title: "Suche nach Liebe",
                  description: "Everything about Vanilla JS",
                  latestTopic:
                  "Diskussion] Der ideale asdf Gaming-PC er ideale asdf Gamin(1..."
                  }
                  }
                  }
                  };

                  Object.keys(data).forEach(key => {
                  let { title, topics } = data[key];
                  Object.keys(topics).forEach(key => {
                  console.log(`Topic title -> ${topics[key].title}`, `Group title -> ${title}`);
                  });
                  });





                  share|improve this answer













                  I wrote a small JS function for this, hopefully you can use this and convert into JSX.



                  let data = {
                  0: {
                  title: "Languages",
                  topics: {
                  0: {
                  title: "Javascript",
                  description: "Everything about Vanilla JS",
                  latestTopic:
                  "Diskussion] Der ideale asdf Gaming-PC er ideale asdf Gamin(1..."
                  },
                  1: {
                  title: "C#",
                  description: "Microsoft's go to language",
                  latestTopic: "Main geiles Topic alter"
                  }
                  }
                  },
                  1: {
                  title: "Coding Partner Search",
                  topics: {
                  0: {
                  title: "Suche nach Liebe",
                  description: "Everything about Vanilla JS",
                  latestTopic:
                  "Diskussion] Der ideale asdf Gaming-PC er ideale asdf Gamin(1..."
                  }
                  }
                  }
                  };

                  Object.keys(data).forEach(key => {
                  let { title, topics } = data[key];
                  Object.keys(topics).forEach(key => {
                  console.log(`Topic title -> ${topics[key].title}`, `Group title -> ${title}`);
                  });
                  });






                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Nov 15 '18 at 11:28









                  theapologisttheapologist

                  576215




                  576215






























                      draft saved

                      draft discarded




















































                      Thanks for contributing an answer to Stack Overflow!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function () {
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53317981%2fhow-can-i-map-over-and-object-that-contains-another-object-i-want-to-map-over-a%23new-answer', 'question_page');
                      }
                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      Bressuire

                      Vorschmack

                      Quarantine