I have a state variable which is an array. Each element is a string. I am trying to map each element to a checkbox input type, but it fails.
When I try to map them to a p tag to segregate each element into different paragraphs, it works. But when I use input type it shows blank.
return (
<div className="pdf" id="check">
{this.state.content.map((txt) =>
<p><input type='checkbox' value={txt} /></p>
)}
</div>
Here this.state.content is an array of string elements, and with only p tag it works fine but after including input tag it renders the checkboxes but content is blank.
I need a checkbox at the start of each element when I print it.