Answer the question
In order to leave comments, you need to log in
I can not understand one topic on react What should I do?
const database = [
{
id: 1,
name: "TV",
price: 100000,
bought: false,
rating: 4,
},
{
id: 2,
name: "Car",
price: 315999,
bought: false,
rating: 4,
}
Answer the question
In order to leave comments, you need to log in
const [database, setDatabase] = useState()
function qweqwe (id){
setDatabase(database.map(e => {
if(e.id === id) {
e.bought = true
}
return e
})
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question