I’m planning to display the data of orders
.
This is the data:
const orders = {
firstName: "Jennie",
lastName: "asdasda",
address: "US",
number: "",
order: [
{ product: "Tumbler - 500- ML ", variation: [{ qty: 12, color: "red" }] },
{ product: "Shirt - M ", variation: [{ qty: 14, color: "green" }] }
],
instructions: "asdasdad",
contact: "877827348"
};
This what I tried but it is causing an error that says:
Objects are not valid as a React child (found: object with keys {product, variation}). If you meant to render a collection of children, use an array instead
Also in codesandbox: sad-boyd-zm3jin - CodeSandbox
{Object.entries(orders).map(([key, val]) => (
<h2 key={key}>
{key}: {val}
</h2>
))}