Table with react-bootstrap

Kms74 Sep, 2022

กำหนดแม่แบบตาราง โดยศึกษารูปแบบจาก react-bootstrap แล้วให้รีเทิร์นค่าออกมาตาม props ที่เรากำหนด

  • header = อาร์เรย์ชื่อส่วนหัวตาราง (column header)

  • data = อาร์เรย์ข้อมูลที่นำมาแสดงในตาราง

    <Tables data={data} header={["column1", "column2", "...columN"]} />

  • กำหนด {data} ด้วยการดึงข้อมูลจำลองมาจาก https://fakestoreapi.com

Get all products

    fetch('https://fakestoreapi.com/products')
                .then(res=>res.json())
                .then(json=>console.log(json))

อ้างอิง

Last updated