Сообщение от destus
|
array = [
{
...object,
name: "Name1, Name, Name3".split(/,\s/)
}
];
<ul>
{project.name.map(text => <li>{text}</li>)}
</ul>
|
Не подходит, пишет что Cannot read property 'map' of undefined
projects: [
{
id : 1,
name: "name1, name2, name3".split(/,\s/)
}
]
};
import React from 'react';
//redux
import { connect } from 'react-redux';
//css
import './projects.css';
const Projects = ({ projects }) => {
return (
<ul>
{
projects.name.map((text) => {
return (
<li>{text}</li>
)
})
}
</ul>
)
};
const mapStateToProps = ({ projects }) => {
return { projects };
};
export default connect(mapStateToProps)(Projects);