I am trying to return a component without a set name at runtime. Like so:
<div className="project-demo">
<CustomComponent demo={project.demo}/>
</div>
and being called like this:
const CustomComponent = ({ demo }) => {
return (
<{ demo } />
)
}
Any advice?
JSX expects components to have capitalized names
const CustomComponent = ({ demo }) => {
const Demo = demo;
return (
<Demo />
)
}
or better:
const CustomComponent = ({ Demo }) => {
return (
<Demo />
)
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.