1

I can't get my two arrays to add a label and the label description. It all seems to mesh together. I have the JSON data in a database imported as "db" all of it comes messed together. [![This is the image to see I don't know if I'm explaining right new to react][1]][1]

  
    "title_FQA":  "What Statuses are Used for Projects?",
    "tag_FQA": [ "Critical", "High", "Medium", "Low"],
    "description_FQA": ["New products or functionality affecting customer usage with confirmed public release date within 30 days.",
    "New products or functionality affecting customer usage with confirmed public release date within 90 days.",
    "Enhances functionality or streamlines business processes, but is not required.",
    "Modify appearance of screens, terminology, or customize base system applications for cosmetic purposes."
    ]

/////////////////////React Code /////////////////

        <Grid paddingTop={3} container justifyContent="space-evenly">
      {db.map((post) => {
        return (
          <Widget>
            <Typography paddingBottom={3} variant="h3">
              {post.title_FQA}
            </Typography>
            <Grid>
            {post.tag_FQA}
            {post.description_FQA}
            </Grid>
            </Widget>
            </Grid>




    


  [1]: https://i.sstatic.net/ym8u7.png
1

1 Answer 1

2

If I'm understanding correctly, you will need to specify which items in each tag and description array to display, for example:

{post.tag_FQA[0]}
{post.description_FQA[0]}

Would return:

Critical

New products or functionality affecting customer usage with confirmed public release date within 30 days.

{post.tag_FQA[1]}
{post.description_FQA[1]}

Would return:

High

New products or functionality affecting customer usage with confirmed public release date within 90 days.

For a little more automation, add another map function to iterate over the tag and description arrays withing each post:

{db.map((post) => {
  return (
    <Widget>
      <Typography paddingBottom={3} variant="h3">
        {post.title_FQA}
      </Typography>
      {post.tag_FQA.map((tag, index) => 
        <Grid>
          {tag}
          {post.description_FQA[index]}
        </Grid>
        )
      }
    </Widget>
  )}
)}
Sign up to request clarification or add additional context in comments.

1 Comment

Thank you sorry for my improper formatting but thank you for understanding and your help it works!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.