Typo in "attrs as keys" figure on the store doc page.
luv2code opened this issue · 1 comments
luv2code commented
In the store doc page, the code figure reads like this:
export default function MyElement({ html, state }) {
const { attrs, store } = state
const { message='', bookId='' } = attrs
const { books={} } = store
const book = books.bookId
const bookTitle = book.title || ''
return html`
<div>
<h3>${bookTitle}</h3>
</div>
`
}
I believe it should read like so (using the bookId string to index into the books store object):
export default function MyElement({ html, state }) {
const { attrs, store } = state
const { message='', bookId='' } = attrs
const { books={} } = store
const book = books[bookId]
const bookTitle = book.title || ''
return html`
<div>
<h3>${bookTitle}</h3>
</div>
`
}
ryanblock commented
Totally, another excellent find. Thank you, this will be live in a few minutes!