ReactJS map through Object

前端 未结 8 2134
别跟我提以往
别跟我提以往 2021-01-31 16:53

I have a response like this:

I want to display the name of each object inside this HTML:

{subjects.map((item, i) => (
  
  • 8条回答
    •  广开言路
      2021-01-31 17:16

      I use the below Object.entries to easily output the key and the value:

      {Object.entries(someObject).map(([key, val], i) => (
          

      {key}: {val}

      ))}

    提交回复
    热议问题