Quantcast
Channel: React + Redux - architectural Apis approach - Stack Overflow
Viewing all articles
Browse latest Browse all 2

React + Redux - architectural Apis approach

$
0
0

I have a react app with redux, I two api calls that get the data for me.

The first api call returns a group of questions array.

The seccond api call returns a group of answers for each question

I also have an api call to get the answers for specific question

First Api Call

{parent: 1, name: "default", id: 36}{parent: 36, name: "help?", id: 2}{parent: 36, name: "help me?", id: 3}{parent: 35, name: "Don't help them?", id: 3}

Second Api Call

{answer: "Yes", questionid: 2, id: 1, question: "help?"}{answer: "No", questionid: 2, id: 2, question: "help?"}{answer: "Maybe", questionid: 2, id: 3, question: "help?"}{answer: "Yes", questionid: 3, id: 1, question: "help me?"}{answer: "No", questionid: 3, id: 2, question: "help me?"}

Data should appear like below

Group Name: default

help? Yes, No, maybe

help me? Yes, No

How can I do this, should I loop for the questions then every question I should loop for the answers, all in two api calls, or I should loop on the questions and every question I should call the api for the answers?


Viewing all articles
Browse latest Browse all 2

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>