By passing every single projectsList object as prop in it's React component (named ProjectsItem) and then map it through so every project infos object in it's <li> tag inside that <ul>:
Error in the end
Intro.js file
Projects Lists (objects):
const [frontEndProjects, setFrontEndProjects] = useState([{
projectInfos: [{ name: "Imobile Shop", href: "" }],
projectInfos: [{ name: "Portfolio template", href: "" }],
projectInfos: [{ name: "Responsive Design Practice", href: "" }],
}]);
const [machineLearningProjects, setMachineLearningProjects] = useState([{ projectInfos: [{ name: "Hazel AI", href: "" }] }]);
const [backEndProjects, setBackEndProjects] = useState([{
projectInfos: [{ name: "My Little Market", href: "" }],
projectInfos: [{ name: "Todo List app", href: "" }],
}]);
const [webScrapingProjects, setWebScrapingProjects] = useState([{
projectInfos: [{ name: "Business list", href: "" }],
projectInfos: [{ name: "Weather Scraper", href: "" }],
projectInfos: [{ name: "Amazon Price Tracker (done deployement soon)", href: "" }],
}]);
const [javaScriptProjects, setJavaScriptProjects] = useState([{
projectInfos: [{ name: "Javascript: Blackjack - Rock Paper Scissors", href: "" }],
projectInfos: [{ name: "Instagram clone ReactJs", href: "" }],
projectInfos: [{ name: "Facebook Messenger clone ReactJs", href: "" }],
projectInfos: [{ name: "Netflix clone ReactJs", href: "" }],
projectInfos: [{ name: "Amazon clone ReactJs", href: "" }],
projectInfos: [{ name: "Tinder clone ReactJs ( Under Dev )", href: "" }],
projectInfos: [{ name: "Youtube clone ReactJs (LIVE DEMO soon)", href: "" }],
projectInfos: [{ name: "Spotify clone ReactJs (LIVE DEMO soon)", href: "" }],
}]);
const [dataScienceProjects, setDataScienceProjects] = useState([{
projectInfos: [{ name: "Process workbook-Edting Excel files", href: "" }],
}]);
and the same file
return (
<ProjectsItem projects={frontEndProjects} />
<ProjectsItem projects={machineLearningProjects} />
<ProjectsItem projects={backEndProjects} />
<ProjectsItem projects={webScrapingProjects} fadeOut />
<ProjectsItem projects={javaScriptProjects} fadeOut />
<ProjectsItem projects={dataScienceProjects} />
Then in the other file imported as props
function ProjectsItem(props) {
<div className="project-inner-container">
<ul>
{props.projects.map((project) =>
project.projectInfos.map((projectInfo) =>
<li>{projectInfo.projectInfos.name}</li>))}
</ul>
</div>
}
it always shows only one project or it fires off an error when i go like
project.projectInfos.map is not a function
when i try to fix it by changing the .map place like
project.map((infos) => <li>{infos.projectInfos.name})
project.map is not a function
or
project.map((infos) => <li>{infos.name})
i've tried also adding 3rd map function for the names even i think a third one may fix it but don't know how to make it like the wording:
<ul>
{props.projects.map((project) =>
project.projectInfos.map((projectInfo) =>
projectInfo.map((name) =>
<li>{name}</li>)))}
</ul>
also no way it fires off
projectInfo.map is not a function
i've tried to summarize by giving a brief statement because the error is in the Map() in my opinion.
Appreciate also hints about the code and improvement tricks
<li>{projectInfo.name}</li>{projectInfo.projectInfos.map((name) => <li>name</li>)}is that logic even