this is an example of how I want to use the function ... I have an API that gets an id and generates a PDF with React PDF Renderer The API route calls the function to get the component needed to generate the PDF
const Component1 = ({ name }: { name: string }) => {
return <div>Component1 with name: {name}</div>;
};
const Component2 = ({ age }: { age: number }) => {
return (