I have this Home component:
import Items from './Items';
class Home extends Component{
render(){
const { items } = this.props;
return(
<div className="container">
<Items items={items}/>
</div>
)
}
}
And Items is this one:
import React from 'react';
const Items = (props) => {
const { items } = props;
items.map(item=>{
return(
<div>
<p>{item.value}</p>
</div>
)
});
};
export default Items;
I'm getting this error:
× Error: Items(...): Nothing was returned from render. This usually means a return statement is missing. Or, to render nothing, return null.
Why? How can I return something if I need to map those items array.
returnthe array returned by the.mapmethod. Currently, the Items component doesn't return anything (only the map callback does) - Nick Parsonsreturn items.map(item=>{? wow, that works, yeah my mistake, thanks - pmiranda