Astro.js & Javascript
Inside of a component i'm trying to map over some data one time and display different data from each rendered component in another file.
The component responsible for mapping the data
---
const skills = [
{
name: 'Frontend',
id: 1,
frontend: [ 'HTML', 'CSS' ]
},
{
name: 'Backend',
id: 2,
backend: [ 'Firebase', 'PHP' ]
}
]
---
{skills.map(skill => (
<li>
<h4 class="role me-2 astro-FP6HE37A"> {skill}
<span class="invert position-absolute d-flex align-items-center justify-content-center h-100 w-100 astro-FP6HE37A"> {skill}</span>
</h4>
</li>
))}
The file responsible for displaying the said component
---
import SkillsIcon from '../components/SkillsIcon.astro';
---
<h3>Frontend</h3>
<SkillsIcon />
<h3>Backend</h3>
<SkillsIcon />