I'm trying to filter my array availableSizes and just display a certain size that I input into includes
I am testing with 5 and it should output just the number 5 but I am getting this is not a function
How can I filter this array so it will just output the numbers passed into the includes method?
render() {
const { id, img, name, price, desc, color, match, material, size, slug } = this.props
const { selectedSize, showSizes } = this.state
const availableSizes = [5,6,7,8,9,10,11,12,13,14,15]
return (
<Wrap>
<Half>
<ImgWrap>
{showSizes &&
<Sizes>
<SizeWrap>
<div>selecta size</div>
{availableSizes.filter(availableSize => availableSize.includes(5)).map((availableSize, index) =>
<Size
key={index}
active={selectedSize === availableSize.size}
onClick={() => this.handleSelectSize(availableSize.size)}
className="snipcart-add-item"
data-item-id={id}
data-item-name={name}
data-item-price={price}
data-item-url="/"
data-item-size={this.state.size}
data-item-description={desc}
>
{availableSize}
</Size>
)}
</SizeWrap>