Sounds like you have access to a structured data about your components from your CMS. I’m going to assume this looks like this:
[
{ component: 'Header', props: { text: 'title1', img: 'link/to/image1' } },
{ component: 'Footer', props: { text: 'title2', img: 'link/to/image2' } },
]
If you have this, you can do something like the following:
---
// 1. Import each component you might need.
import Header from '../components/Header.astro';
import Footer from '../components/Footer.astro';
// 2. Create an object to use to look up your components.
const components = { Header, Footer };
const cmsData = getCmsData(); // Pseudo code for whatever gets you your data.
---
{cmsData.map(({ component, props }) => {
// 3. Use the object to look up your components.
const Component = components[component];
return <Component {...props} />
})}
This is based on the basic Dynamic Tags example in the Astro docs.