I have a component that has props that are components.
Component example:
```jsx
import FavoriteBorder from '@material-ui/icons/FavoriteBorder'
import Favorite from '@material-ui/icons/Favorite'
return (
<Component
favIcon={{
icon: FavoriteBorder,
iconSelected: Favorite,
}}
/>
)
```
SyntaxError: Cannot use import statement outside a module
How can I import props
It turns out the ;
is the key to this problem.
PropertyCardNew example:
```jsx
import FavoriteBorder from '@material-ui/icons/FavoriteBorder'
import Favorite from '@material-ui/icons/Favorite'
;<PropertyCardNew
images={
[
{
url: 'https://www.commerciallistings.cbre.co.uk//resources/fileassets/GB-Plus-480572/09e35192/11%20Strand%201_Photo_1_small.jpg',
alt: "An Image"
},
{
url: 'https://www.commerciallistings.cbre.co.uk//resources/fileassets/GB-Plus-480572/09e35192/11%20Strand%201_Photo_1_small.jpg',
alt: "An Image"
}
]
}
title="PricewaterhouseCoopers"
favIcon={{
icon: FavoriteBorder,
iconSelected: Favorite,
}}
subTitle="4th floor"
street="313 Stoughton Rd Edgerton, WI 53534-1132"
date="September"
desks="20+"
rent="$5600"
labels={{
date: 'date',
desks: 'desks',
rent: 'Monthly rent',
link: 'Details',
}}
link="https://commerciallistings.cbre.co.uk"
/>
```
I hope this helps somebody.
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.