I have this code, inside of my code I am using a component, this should be possible?
let newBox = document.createElement("span")
for (let a = 0; a < suggestions.length; a++) {
let newDiv= <Option value={suggestions[a]}/>
newBox.appendChild(newDiv)
}
item.appendChild(newBox)
This component its only this:
import React, { useState } from 'react';
const Option = (value) => {
return (<div className="divBorder"> {value} </div>)
}
export default Option
Btw: I have this error in this part:newBox.appendChild(newDiv)
This is the error:
TypeError: Node.appendChild: Argument 1 does not implement interface Node.
divelement and set theinnerHTML.