Your return statement should look like this
return (
<React.Fragment>
<Styles>
<Container>
<Row className='rows container'>
{results.length > 0 &&
results.map(result => (
<Col className='columns ' xs={12} sm={6} md={4} lg={3}>
<img src={result.poster_path} alt='movie poster' />
</Col>
))}
</Row>
</Container>
</Styles>
</React.Fragment>
)
(I removed the square brackets from around results.map
)
Square brackets are used to inform jsx that you are going to execute javascript inside the jsx. You already started that execution on {results.length
, if you add another pair of brackets inside the js execution block it will be perceived by js as you creating an object, hence the expected comma error.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…