'How to check some favorites objects?
Tell me please.There's an array of objects.when user clicks on the icon to write this object in LocalStorage. But how to do it if there some objects to check.The problem that when writing to Local Storage, objects are overwritten. How to do it correctly?
{sortedProjects?.map((project) => (
<TableRow key={project._id} hover>
<TableCell>
<EmptyStar color='primary' className={classes.starIcon} onClick={()=>
{localStorage.setItem(`${project._id}`, JSON.stringify(project));
let list = JSON.parse(localStorage.getItem(`${project._id}`));
console.log(list)}/>
<Link>{project.name} </Link>
</TableCell>
</TableRow>
))}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
