Skip to content

Instantly share code, notes, and snippets.

@rileybathurst
Created June 12, 2024 21:33
Show Gist options
  • Save rileybathurst/48b08ab7fd237356869eea50c73b3fb0 to your computer and use it in GitHub Desktop.
Save rileybathurst/48b08ab7fd237356869eea50c73b3fb0 to your computer and use it in GitHub Desktop.
spread array
import * as React from "react";
interface BreadcrumbTypes {
name: string;
item: string;
}
function Breadcrumb(breadcrumbs: BreadcrumbTypes[]) {
return (
<>
test
{Object.entries(breadcrumbs).map(([key, item]) => {
console.log(typeof key); // string
console.log(parseInt(key) + 1);
// console.log(item);
console.log(item.name);
console.log(item.item);
return (
<>
<p>{parseInt(key) + 1}</p>
<p>{item.name}</p>
<p>{item.item}</p>
</>
);
})}
</>
);
}
const DeckPage = () => {
return (
<main>
<h1>Deck</h1>
<Breadcrumb
{...[{
name: "Light",
item: "light"
},
{
name: 'StrapiLight',
item: 'strapiLight'
}]}
/>
</main>
)
}
export default DeckPage
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment