I can not understand how to add key / value to an array. It is necessary to have an array of objects in localStorage, but it is impossible to screw the id to the book object. Help me please!
import UUIDv4 from 'uuid/v4'; function addBook(authorBook, nameBook, yearBook, imageSRC) { const id = UUIDv4(); let book = { author: authorBook, name: nameBook, year: yearBook, imageSRC: imageSRC }; let books = []; let key = id; books.unshift({ key: book }); let parseBook = JSON.stringify(books); return localStorage.setItem('SAVED_BOOK', parseBook); }