Home > OS >  Display specific row from API in react
Display specific row from API in react

Time:08-07

Iam trying to write a map function to show all the item in API

ScreenShoot of code to display the items

and this is the console log of the item that fetch from API

I got Error for the map function that isn't working what is the solution

Thank you

CodePudding user response:

It's a little hard to tell from the picture. But if I understood correctly you have no return. Note that you can only have one div in the return.

export default function Feed(props) {
    const array1=props.graphDataa.value

  return (
    <div>
      {
        postsArr.map(item=> (whatever you want to display...)) 
      }

    </div>

CodePudding user response:

  1. Your div is closed in the opening tag - "taskcolorblack-div"
  2. You need return value from method listmap like this: return map1;
  3. In render function u can call like this return (<>{listmap().join()}</>)
  • Related