15
loading...
This website collects cookies to deliver better user experience
const author1 = {name: "Saransh Kataria"};
const author2 = {name: "Saransh Kataria"};
Object.is(author1, author2); // false
const author1 = {name: "Saransh Kataria"};
author1.name = "Wisdom Geek";
Object.is(author1, author1); // true
const [author, setAuthor] = useState({name:"Saransh Kataria")};
const updateName = () => {
author.name = "Wisdom Geek";
setAuthor(author)
}
const updateName = () => {
setAuthor(prevState => {...prevState, name: "Wisdom Geek"});
}